You do not need to use die as the second function call, it is just used as a convention in almost every mysql_query tutorial.
All we do is evaluate a logical expression. $result = $a OR $b . If the value of $a true, we never execute $b , because we do not need it. We performed a logical OR on one side of the statement, which is true, and thatβs all we need.
The die () function immediately exits the script with the message. You can replace it with your own function to print a pretty error message and continue using the script without exiting. For instance,
function my_error_function($status) { echo "ERROR: $status"; } $result = mysql_query($sql) or my_error_function("Uhoh. There was a problem executing $sql.");
Nick source share