function ejecutarSelect($query)
 {
     try {
         //connect as appropriate as above
         return $this->dataBase->query($query);
     } catch (PDOException $ex) {
         echo "An Error occured!";
         //user friendly message
         some_logging_function($ex->getMessage());
     }
 }
Exemplo n.º 2
0
 function ejecutarSelectPerpared($sentencia)
 {
     try {
         //connect as appropriate as above
         $sentencia->execute();
         echo $sentencia->debugDumpParams();
         return $sentencia;
     } catch (PDOException $ex) {
         echo "An Error occured!";
         //user friendly message
         some_logging_function($ex->getMessage());
     }
 }
Exemplo n.º 3
0
 /**
  * select
  * @param string $sql An SQL string
  * @param array $array Paramters to bind
  * @param constant $fetchMode A PDO Fetch mode
  * @return mixed
  */
 public function Query_AR($where = '', $strOrder = '', $intRecords = 100, $intPage = 1, $_id = 0)
 {
     //if(is_array($this))
     //$table=$this->fie;
     //var_dump($this);// $this->tbl;
     //echo $_id;
     $strWhere = $this->prefix . 'uin > 0 ';
     if ($this->tbl == '') {
         return false;
     }
     if ($_id > 0) {
         $strWhere .= ' and ' . $this->prefix . 'uin =' . $_id;
     }
     if (is_array($this->fields)) {
         $strFields = implode(',', $this->fields);
     } else {
         return false;
     }
     if ($where != '') {
         $strWhere .= ' and ' . $where;
     }
     if ($strOrder != '') {
         $strOrder = 'order by ' . $strOrder;
     }
     $limit = sprintf(' limit %d, %d', ($intPage - 1) * $intRecords, $intRecords);
     $strSQL = "SELECT {$strFields} FROM {$this->tbl} where {$strWhere} {$strOrder} {$limit}";
     try {
         //connect as appropriate as above
         $statement = $this->db->prepare($strSQL);
         //$objRes = $statement->fetch();
         $objRes = $this->db->query($strSQL);
         //invalid query!
     } catch (PDOException $ex) {
         echo "An Error occured!";
         //user friendly message
         some_logging_function($ex->getMessage());
     }
     //echo $strSQL;//die();
     //$objRes = mysql_query($strSQL) or die('Invalid SQL: '.mysql_error());
     //self::$data=$objRes;
     return $objRes;
 }