Noob question re: why I can't get error message or number
Posted: Thu Jan 01, 2009 3:52 pm
HNY!!
I cannot get $mysqli->error or $mysqli->errno to react to a forced error.
<?php
// Connect to the db
$mysqli = new mysqli("localhost", "user", "BADpassWord", "db") // this does create the error
// Check connection
if ($mysqli->errno) // no response from this
{
printf( "The error message is: %s", $mysqli->error); // no response from this
}
?>
PHP does catch the error, but I cannot get MySQL to let me intercede.
I have also tried:
<?php
$mysqli = new mysqli("localhost", "user", "BADpassWord", "db")
or die("Connection failed");
echo "I made it this far";
?>
and "I made it this far" gets printed out to the browser, along with the PHP error message. But it totally ignores the die().
Any help would be appreciated.
Thanks
I cannot get $mysqli->error or $mysqli->errno to react to a forced error.
<?php
// Connect to the db
$mysqli = new mysqli("localhost", "user", "BADpassWord", "db") // this does create the error
// Check connection
if ($mysqli->errno) // no response from this
{
printf( "The error message is: %s", $mysqli->error); // no response from this
}
?>
PHP does catch the error, but I cannot get MySQL to let me intercede.
I have also tried:
<?php
$mysqli = new mysqli("localhost", "user", "BADpassWord", "db")
or die("Connection failed");
echo "I made it this far";
?>
and "I made it this far" gets printed out to the browser, along with the PHP error message. But it totally ignores the die().
Any help would be appreciated.
Thanks