zend框架的使用总结

注意链接不同数据库的时候需要先在init的基础配置里做好链接声明。(controller中)


DB::conn('db_dev');
DB::conn('db');




     以及


$select = $DB->select()
    ->from('money', array('adjust_id','check_id','adjusted'))
    ->where('id = ?', $id);
$result = $DB->fetchRow($select->__toString());//fetchAll的区别






$data = array();
$towhere = $towhere +1;
$data['towhere'] = $towhere;
$DB = Zend_Registry::get('db');
$where = $DB->quoteInto('change_id = ?', $id)
        . $DB->quoteInto('and end = ?', 0);


$row=$DB->update('userflow', $data, $where);


return $row;


每次从数据库存取数据的时候,最好加上表名.字段名的方式,这样可以防止有相同的字段名时,会报错。

猜你喜欢

转载自blog.csdn.net/weixin_41694486/article/details/80495911