【发布时间】:2015-06-12 19:33:01
【问题描述】:
我正在使用 CodeIgniter $db->insert 函数来执行插入操作。但我试图弄清楚如何触发查询错误以查看系统是否记录错误消息。
我试图拼错表格名称,但这不起作用..它只会在页面上显示一条错误消息。
关于如何执行虚假错误的任何想法?下面是我的代码..
任何帮助将不胜感激!
public function newMsgTemplate($template_name, $body){
try {
$this->db->insert("message_template", ['template_name' => $template_name, 'body' => $body]);
trigger_error("error");
} catch (Exception $e){
log_message("error", "There was an error when trying to preform the query ");
}
【问题讨论】:
标签: php mysql codeigniter