Gorilla3D Primative Teachings

Joseph Says: STOP SPAMMING MY %$#@ING SITE $%#@!!!!!
Search

Gorilla Db - MySQLi Wrapper


Monday, April 7, 2008

Db has been used in a number of my projects, the main focus of this class is to simplify the overall process of prepared statements. As this was migrated into my work place need for docs and log functions was created.

Db is a connection manager, it will use the connection you first create throughout your application. You can continue to call Db:init() and as long as a connection has already been made, you can run queries. Best of all It has prepared statements thanks to Wrapping MySQLi. For documentation and download please visit Gorilla Labs

  1.  
  2. $db = Db::init('localhost', 'root', 'pass', 'clients');
  3.  
  4. //-- Prepared Statements
  5. $rows = $db->query('SELECT * FROM blog_entries WHERE pub_date < ?', array('2008-04-01'));
  6.  
  7. echo 'Number of result: ' . $db->count();
  8. echo '<br/>';
  9.  
  10. echo 'SQL executed: ' . $db->debug();
  11. echo '<br/>';
  12.  
  13. $rows = $db->fetchAll();
  14. /* Output:
  15.  * Number of result: 22
  16.  * SQL executed: SELECT * FROM blog_entries WHERE pub_date < '2008-04-01'
  17.  */
  18.  

Comments


No comments

Add Comment