Return error
Started using your class and it works great except when I had a typo in my SQL and was wondering why nothing was being inserted into my DB. A great addition to the script would be to display an error if a query fails. Keep up the good work.
You should be able to use the $lastError variable to return this..
$db = new MySQL('.....'); /query stuff...mmmkay/ echo $db->lastError;
Hope it helps.
I'm using the PDO class which doesn't have a lastError variable.
Hi. I know I'm late to the game here, and you're probably better off using a different framework, but if you want to see the error, you can add
echo "\nPDOStatement::errorInfo():\n"; $arr = $stmt->errorInfo(); print_r($arr);
after line 57 in class.DBPDO.php
You'll likely need to comment those lines out or put in a DEBUG = TRUE statement to flip that info on and off... there's probably a better way to do it... but yeah, thats all I got right now.
has anyone got a solution for this ? how to see the errors ?
i got it ! , check my DBPDO.php file > https://github.com/mrbeandev/PHP-MySQL-Class 😄