vBulletin Mods

The Official vBulletin Modifications Site

Suppress Database Error
by BulliM
31 Jan 2019 10:46

vB results an error, when I try to delete a non existing row. DELETE FROM same_table AS a WHERE EXISTS (SELECT * FROM same_table AS b...) or @ before are not working. Any idea how to supress this error?

BulliM 31 Jan 2019 15:37

Will look at. Thank you so far.

shka 31 Jan 2019 15:42

Sorry I read column, not row. What is the goal of your sql-statement.

BulliM 31 Jan 2019 15:44

DELETE FROM database.table WHERE userid =$ LIMIT 1

So instead of updating, I prefer to delete and recreate this entry in this case, because I doesn't know, if this entry already is created.

shka 31 Jan 2019 15:50

Delete all from table? Or is generation the condition "=$" your problem?

BulliM 31 Jan 2019 15:55


Originally Posted by shka (Post 2598315)
Delete all from table? Or is generation the condition "=$" your problem?

Delete only and single row from table if exists. $ means e.g. 1 or 51 or an other variable userid. In this table I store some data, who needs to be refreshed in intervals - only if they exist.

shka 31 Jan 2019 16:08

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

All times are GMT. The time now is 19:17.

Powered by vBulletin® Version 3.8.14
Copyright © 2022, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.