How to throw custom error in PHP mysql -
$row=mysql_fetch_array($result, mysql_assoc) or die(mysql_error())
in code mysql_error displayed if mysql_fetch_array fails.is there way throw mysql_error reloading page.
p.s: know mysql has been depreciated. old project.so please dont suggest answer use mysqli , pdo.i aware of it.please tell me way throw reload page error.
you use try catch exception handling in php
http://www.php.net/manual/en/language.exceptions.php
try { // can go wrong } catch (exception $e) { throw new exception( 'something wrong', 0, $e); }
or
try { // can go wrong } catch (exception $e) { if ($e instanceof customexception) { // } else if ($e instanceof otherexception) { // } else { // } }
or
try { } catch (customexception $e) { } catch (otherexception $e) { } catch (exception $e) { }
Comments
Post a Comment