I am converting a php script which contains mysql_* functions to PDO.
i want to dislay all the sql related errors in my old script but i noticed that wherever there is an error in the sql syntax, php will output a blank page even if error reporting is turned on. Also the error is not logged in the log file.
If i use mysql_error() function at the end of the script which contains multiple sql queries, then the errors reported by the individual sql queries will be overwritten and only the last created error will be displayed.
So my question is instead of using die() or mysql_error() functions at the end of each and every sql query, is there a way by which i can view all the errors in the script at once?
i am using PHP version 5.3.8 and mysql version 5.5.
This is not recommended. Because instead of stopping the script (usually at the critical point) it would continue execution.
However if you really need this, you can keep all
SQLerrors in some container, for instance, like,$errorsarray. It would look like this (procedural code) :error_reportinganddisplay_errorsthey both have nothing to do with SQL errors, but PHP engine itself. They won’t show any SQL error.And also, as usual, stop using
mysql_*functions