I am new to mysqli, and trying to confirm that if I so something like the below, the errno will be set to the last error, if any, and not the error of the last query.
Is this a decent practice or should I be checking for the error in between every query?
Thanks!
$mysqli->autocommit(FALSE); $mysqli->query('INSERT INTO .....'); $mysqli->query('INSERT INTO .....'); $mysqli->query('INSERT INTO .....'); $mysqli->query('INSERT INTO .....'); $mysqli->query('INSERT INTO .....'); if ( 0==$mysqli->errno ) { $mysqli->commit(); } else { $mysqli->rollback(); // Handle error }
mysqli_errno — Returns the error code for the most recent function call.