Objective
This article is mainly about the PHP code in the monitoring data successfully inserted into the MySQL database, you can use these two ways. The following words do not say much, to see the detailed solution.
Solving method
The first is to judge by the mysql_query () function:
if (mysql_query (' insert INTO ... '))//returns True after the insert succeeds, the failure returns false
echo "Success";
Else
echo "failed";
The second is to use the Mysql_affected_rows () function to return whether the value is greater than the 0来 judgment:
mysql_query ($sql 1); $flag 1 = mysql_affected_rows ();
mysql_query ($sql 2); $flag 2 = Mysql_affected_rows ();
mysql_query ($sql 3); $flag 3 = Mysql_affected_rows ();
if ($flag 1>0 && $flag 2>0 && $flag 3>0) {
echo ' Insert succeeded ';
} else{
echo ' Insert failed ';
}
Summarize
The above is the entire content of this article, I hope the content of this article for everyone to learn love or work can bring some help, if you have questions you can message exchange.