Article From:https://www.cnblogs.com/huangshizhou/p/9833952.html

$result=mysql_query($query),The purpose of this function is to execute a correct SQL statement. If it is a simple query such as insert, update, delete, it will not return the result.

And $result will be either 1 or “(that is, nothing). Although online data says that the return is TRUE or FALSE, it has been proved by practice that the return is 1 or nothing.

For queries that return records, such as select, sho, explain, etc., a resource link to the query result will be returned. If the query is invalid, there will be nothing.

The judgement statement should be written as follows:

<?php
$result=mysql_query($qury);
if($result){
#sqlStatement successfully executed
}else{
#sqlStatements that fail to execute

}


?>

 

Leave a Reply

Your email address will not be published. Required fields are marked *