Just use a combination of mysql_errno() and mysql_error():
echo mysql_errno() . ": " . mysql_error(). "\n";
PS. Documentation always rocks!
I've been playing with PHP for a while now, and love the mysql
but there's one thing I'd like to know...
I want to check if a mysql error is a certain number, and thats all
enough because every time i encounter an error I can write down what
error was. However, it would be handy if I could have my own define
with all the errors in. Can I ask if anyone has a list of errors and
numbers for mysql_errno? I've looked on the web and found a load of
for the mysql daemon (the page told me to look in
/usr/share/mysql/mysql_errors.txt) but this isnt the file I want as the
errors there relate to the server and not errors with a query I'm
Thanks in advance for any help
EMPICS Sports Photo Agency