Advertisement
Be0wulf

Hardcoding

Oct 3rd, 2012
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. /* -- inside the class --*/
  4.     public function select($reqSelect, $parameters = array(':id' => $id_to_select)) {
  5.         try {
  6.             $this->con = parent::beginTransaction();
  7.             $result = parent::prepare($reqSelect);
  8.            
  9.             $result->execute($parameters);
  10.  
  11.             //$this->con = parent::commit();
  12.             $this->con = parent::rollBack();
  13.  
  14.             return $result;
  15.  
  16.             $result->closeCursor();
  17.         } catch (Exception $e) {
  18.             die('Error:' . $e->getMessage());
  19.         }
  20. }
  21. /* -- inside the class --*/
  22.  
  23.    $mysql = new Mysql();
  24.    $mysql->select('SELECT * FROM articles WHERE id = :id ');
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement