I noticed something today and thought that it could cause huge problems in the future. Let me explain;
Example; I have a like this
$query1 = "INSERT INTO table1(col1,col2,col3) VALUES('$col1','$col2','$col3')";
$query2 = "INSERT INTO table2(col1,col2,col3) VALUES('$col1','$col2','$col3')";
$query3 = "UPDATE table3 SET col1 = '$col1' WHERE id='$id'";
if (mysql_query($query1) && mysql_query($query2) && mysql_query($query3)) {
echo "successful message";
}
else {
echo mysql_error();
}
When this happens, non-error queries are processed. So if one of them fails, the statistics screen is wrong.
What I want to do;
If there is an error in one of the queries, none should be processed. How can i do that?