miholeus

query builder

Jul 11th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. $db = \Db::getInstance();
  2. // query returns statement
  3. $stmt = $db->createCommand()->select()->from(array('m' => 'managers'))
  4. ->where('man_id = :man_id')->query(array('man_id' => 1));
  5. var_dump($db->fetch_assoc($stmt));
  6.  
  7. $db = \DbFactory::getConnection('crm_extended');
  8.  
  9. // here we build select object
  10. $select = $db->createCommand()->select()->from('error_log')->limit(1);
  11. // we can print it anytime
  12. echo $select;
  13. var_dump($db->q_assoc_one($select));
Advertisement
Add Comment
Please, Sign In to add comment