I have this great function that gets a lot of different data and inserts it into several tables. Not all data is always available, so not all SQL INSERT queries are successful. I need to check which SQL INSERT query was completely successful, and what was not done with such data (for example, inserting into a log table or the like).
Just to give you an example of how I think this can be done:
$sql = 'INSERT INTO data_table (ID, column1, column2) VALUES(?, ?, ?)'; if ($stmt->prepare($sql)) { $stmt->bind_param('iss', $varID, $var1, $var2); if ($stmt->execute()) { $success == TRUE;
I'm not quite sure if this is the best way, and if it always really shows if the data has been inserted into the table ... Any suggestions?
source share