我试图在不是默认数据库的数据库上使用受影响的行。该查询正常运行,但是在检查受影响的行时出现错误。
这是代码:
function activate_tlf($tlf) {
$tlfDB = $this->load->database('tlfDB', TRUE);
$tlfDB->where('tlf', $tlf);
$q_get = $tlfDB->get('control');
if ($q_get->num_rows()>0) {
$q_delete = $tlfDB->delete('control', array('tlf' => $tlf));
if ($tlfDB->affected_rows > 0) $result = TRUE;
else $result = FALSE;
} else $result = FALSE;
$tlfDB->close();
$this->load->database();
return $result;
}
它给了我这个:消息:未定义的属性:CI_DB_mysql_driver :: $ affected_rows
据我了解,当您要使用默认数据库时,会使用$ this-> db,因此我正在为其使用新的db对象。提前致谢。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句