Log in

View Full Version : Resolved Delete if present



bluewalrus
07-20-2011, 03:50 AM
How can I determine if a record has been deleted without running a select query first?


delete from `markers` where id = n

traq
07-20-2011, 03:59 AM
use mysql_affected_rows() afterwards (1 means it was deleted, 0 means it wasn't (for whatever reason - didn't exist, mysql error, etc.)).

bluewalrus
07-20-2011, 04:31 AM
Nice, thanks wasn't aware of that function. I should probably go through the available mysql functions.

traq
07-20-2011, 02:25 PM
no problem : )