note 93457 modified in mysqli.commit by danbrown

From: Date: Thu, 10 Sep 2009 19:52:50 +0000
Subject: note 93457 modified in mysqli.commit by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160436@lists.php.net to get a copy of this message
The compactness of Lorenzo's code is admirable. However, it is a good idea to also check $mysqli->affected_rows to make sure that the INSERT statement did not fail. <?php $result_query = @mysqli_query($query, $connect); if (($result_query == false) && (mysqli_affected_rows($connect) == 0)) { // verify the query executed completely and verify that it // had impact on the table $success = false; // here also, the developer could choose to add a ROLLBACK // statement } ?> --was-- The compactness of Lorenzo's code is admirable. However, it is a good idea to also check $mysqli->affected_rows to make sure that the INSERT statement did not fail. $result_query = @mysqli_query($query, $connect); if (($result_query == false) && (mysqli_affected_rows($connect) == 0)) { // verify the query executed completely and verify that it // had impact on the table $success = false; // here also, the developer could choose to add a ROLLBACK // statement } http://php.net/manual/en/mysqli.commit.php

« previous php.notes (#160436) next »