View Single Post
Downtown1
Veteran Member
Join Date: Mar 2004
Old 06-13-2004 , 16:13  
Reply With Quote #6

Quote:
Originally Posted by BAILOPAN
If the result is an empty set, the return value for the result handle (in this program, it is res), will be 0.

That's why I did <0 for INSERT, to check if the insert succeeded, and <=0 for SELECT, to make sure there were items in the table.

Last insert id is a MySQL only feature so I won't add it to the DBI I think. You can do this:
SELECT MAX(field) FROM table
and get the first (only) result.
If it's 0 for an "Empty set," why would you be printing an error if res == 0? An "Empty set" is a perfectly legitimate response from the DB, is it not?
Downtown1 is offline