Mysql error handling/Try catch

…衆ロ難τιáo~ 提交于 2019-12-25 09:27:55

问题


If table column does not exist mysql shows error .How to fix it using try catch or error handling method

Thanks


回答1:


you can handle the mysql error in this way

 if ( ! $this->db->query('SELECT `name`,`age` FROM `example`'))
{
        $error = $this->db->error(); // Has keys 'code' and 'message'
}


来源:https://stackoverflow.com/questions/44732546/mysql-error-handling-try-catch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!