if(mysql_num_rows($results)) {
$sql = "UPDATE `table` SET `column` = '123' WHERE `id` = 1 LIMIT 1";
$update = mysql_query($sql, $conn) or die(mysql_error());
if($update) {
echo "<p>The table has been updated successfully.</p>";
}
else {
echo "<p>Sorry, an error occurred. Please try again.</p>";
}
}
I wrote the bit of code above. It works, but there's something about it that I don't understand.
If the update were to encounter an error, will I see the MySQL error message or the else statement error message?
How would you have written this code?
How could I have deliberately caused an error to see what happens?
I appreciate the help that I get on this site very much. Learning loads!