This may be rather noobish but I’m gonna ask anyhow. I have a class that inserts into my database. After the insert is finished, I would like to be able to test whether the insert was successful. Can someone tell me what a good way to do this may be?
I call the class like this:
foo = new Myclass('my params');
print_r($foo) returns an object. Again, all I am interested in is testing whether the insert was successful or not.
From https://www.php.net/manual/en/function.mysql-db-query.php
Returns a positive MySQL result resource to the query result, or FALSE on error. The function also returns TRUE/FALSE for INSERT/UPDATE/DELETE queries to indicate success/failure.
So you can have MyClass set an error flag in the constructor, as the return value from mysql_db_query() you then check for in your code..
hope this helps!