php - MySQL错误处理/ try catch

标签 php mysqli error-handling try-catch codeigniter-3

如果表列不存在,mysql显示错误。如何使用try catch或错误处理方法修复它

谢谢

最佳答案

您可以通过这种方式处理mysql error

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

关于php - MySQL错误处理/ try catch ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44732546/

相关文章:

php - Wordpress 短代码传递值数组

php - MySQL 不会更新为零作为值

php - 通过Android App注册时Mysql查询出错

error-handling - MIDI 流的轻量级冗余纠错和防丢失

php - 与 XSS 相关的 htmlspecialchars 与 htmlentities

php - 2011 年 PHP 中的 XSS 方法?

php - 解析错误 : syntax error: unexpected '}'

php - 无法从数据库(数组)回显数据,PHP

php - 如何使用FluentPDO检测错误

android - AdMob错误: “You must have AdActivity declared in AndroidManifest.xml with configChanges”