// Run the Query
if (FALSE === ($this->result_id = $this->simple_query($sql)))
{
if ($this->save_queries == TRUE)
{
$this->query_times[] = 0;
}
// This will trigger a rollback if transactions are being used
$this->_trans_status = FALSE;
if ($this->db_debug)
{
// grab the error number and message now, as we might run some
// additional queries before displaying the error
$error_no = $this->_error_number();
$error_msg = $this->_error_message();
// We call this function in order to roll-back queries
// if transactions are enabled. If we don't call this here
// the error message will trigger an exit, causing the
// transactions to remain in limbo.
$this->trans_complete();
// Log and display errors
log_message('error', 'Query error: '.$error_msg);
return $this->display_error(
array(
'Error Number: '.$error_no,
$error_msg,
$sql
)
);
}
return FALSE;
}
结束日期
// Run the Query
if (FALSE === ($this->result_id = $this->simple_query($sql)))
{
if ($this->save_queries == TRUE)
{
$this->query_times[] = 0;
}
// This will trigger a rollback if transactions are being used
$this->_trans_status = FALSE;
if ($this->db_debug)
{
// grab the error number and message now, as we might run some
// additional queries before displaying the error
$error_no = $this->_error_number();
$error_msg = $this->_error_message();
// We call this function in order to roll-back queries
// if transactions are enabled. If we don't call this here
// the error message will trigger an exit, causing the
// transactions to remain in limbo.
$this->trans_complete();
// Log and display errors
log_message('error', 'Query error: '.$error_msg);
return $this->display_error(
array(
'Error Number: '.$error_no,
$error_msg,
$sql
)
);
}
$CR = new CI_DB_result();
return $CR;
}
6条答案
按热度按时间zi8p0yeb1#
a6b3iqyw2#
删除配置项和
oiopk7p53#
首先让您自动加载数据库
如果您尝试加载库,请使用$CI示例http://www.codeigniter.com/user_guide/general/ancillary_classes.html#get-instance
应用程序〉库〉示例.php
如果在模型上
应用程序〉模型〉示例模型.php
ajsxfq5m4#
更新一个CI核心文件并解决错误:
转到:系统/数据库/并编辑DB_active_rec.php文件转到第990行并查看吹塑代码
更新至
希望已解决您的
num_rows()
问题。cotxawn75#
类Site_m扩展MY_Model {
}
/* 文件site_m.php结束 */
dvtswwa36#
此问题已在核心CI-2文件\系统\数据库\DB_驱动程序. php中修复
代码行https://github.com/bcit-ci/CodeIgniter/blob/develop/system/database/DB_driver.php#L659
在结束代码前替换FALSE
结束日期
默认值应为返回空对象