Ejemplo n.º 1
0
 public static function getTableColumns($tablename)
 {
     $query = 'DESCRIBE ' . $tablename;
     $result = null;
     try {
         $result = Orm::getConnexion()->prepare($query);
         $result->execute();
         $result = $result->fetchAll(\PDO::FETCH_COLUMN);
     } catch (\Exception $e) {
         Orm::logError($query, $e);
     }
     Orm::logSql($query);
     return $result;
 }
Ejemplo n.º 2
0
 public function getItemById($table, $where)
 {
     $query = 'SELECT id FROM ' . $table . ' WHERE ' . $where;
     $result = null;
     try {
         $result = Orm::getConnexion()->prepare($query);
         $result->execute();
         $result = $result->fetch(\PDO::FETCH_ASSOC)['id'];
     } catch (\Exception $e) {
         Orm::logError($query, $e);
     }
     Orm::logSql($query);
     return $result;
 }