is there a way to register error handle function for the mysql functions - trigered when a mysql error happens
something like register_shutdown_function or the catch() in C++
There is a mysql_errno() function which returns 0 if no error occured from the last mysql function and number of the error if such happened.
if(mqsql_errno()){ an error has occured - so you can handle it . }
I know but the idea is not that the idea is something like Java's
try { mysql_connect(); mysql_query(); mysql_query(); mysql_close(); } catch (Exception){ errorhandling(); } catch (OtherException){ errorhandling2(); }
as I mention before
it also can be something like
function myerrorhandle($errno){ switch($errno){ case ..... } }
register_mysql_error_handler("myerrorhandle");
and when mysql fails to call myerrorhandle