I am building a form in PHP. I would like to automatically verify that INSERT queries are successful, and populate data correctly, as opposed to running queries in Workbench or MySQL with every code change.
The only ways I can think of are to count the number of rows before and after, and see if they are equal, or write code to call posted data and compare it to the inserted data, query by query.
Is there some standardized way to go about this?
A Note, I am stuck on PHP 5.3.3
8
Whenever you use a DML statement (INSERT/UPDATE/DELETE), it always returns a integer number. Which can denote the number of rows updated while query execution, OR In case of insertion, it returns ROW ID(I am guessing you have a column named id with auto-increment, If yes this is the value created).