I know the following $sql will fail since there is no Customer='Smith '. I
want to determine how to test a failure of mysql_query.
I thought mysql_query returned false if a query failed. The test fail path
is never taken in the following code is never taken.
Also, I get an invalid argument on mysql_num_rows( $Result) error message.
$sql = "Update Table Set Password='passw ord' where Customer='Smith ';
$Connection = mysql_connect(" localhost", "User", "PW") Or
die(mysql_error ());
$DB = mysql_select_db ("Database", $Connection);
$Result = mysql_query($sq l, $Connection) or die(mysql_error ());
if(!$Result) {
echo "Fail<br>";
}
$Rows = mysql_num_rows( $Result) or die(mysql_error ());
if($Rows > 0) {
echo "Success Rows: $Rows<br>";
} else {
echo "Failure<br >";
}
What do I need to do to test for a mysql_query failure?
Thank you...
Bruce
want to determine how to test a failure of mysql_query.
I thought mysql_query returned false if a query failed. The test fail path
is never taken in the following code is never taken.
Also, I get an invalid argument on mysql_num_rows( $Result) error message.
$sql = "Update Table Set Password='passw ord' where Customer='Smith ';
$Connection = mysql_connect(" localhost", "User", "PW") Or
die(mysql_error ());
$DB = mysql_select_db ("Database", $Connection);
$Result = mysql_query($sq l, $Connection) or die(mysql_error ());
if(!$Result) {
echo "Fail<br>";
}
$Rows = mysql_num_rows( $Result) or die(mysql_error ());
if($Rows > 0) {
echo "Success Rows: $Rows<br>";
} else {
echo "Failure<br >";
}
What do I need to do to test for a mysql_query failure?
Thank you...
Bruce
Comment