It is a question of your error handling style.
You can use "Select count(userId) as userCount from table where userId=$", check if >0 and then delete.
Or you can use directly "Delete form table where userId=$"
But in the same way of my first (deleted) answer - I advice using vBulletin-Api (if your table is in the vB-DB).
vB_dB_Query and the following classes (also for delete, insert, update) includes an property error for handling it