Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 31 Jan 2019, 10:46
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
Suppress Database Error

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?
Reply With Quote
  #2  
Old 31 Jan 2019, 15:37
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
Will look at. Thank you so far.
Reply With Quote
  #3  
Old 31 Jan 2019, 15:42
shka shka is offline
 
Join Date: Mar 2016
Sorry I read column, not row. What is the goal of your sql-statement.
Reply With Quote
  #4  
Old 31 Jan 2019, 15:44
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
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.
Reply With Quote
  #5  
Old 31 Jan 2019, 15:50
shka shka is offline
 
Join Date: Mar 2016
Delete all from table? Or is generation the condition "=$" your problem?
Reply With Quote
  #6  
Old 31 Jan 2019, 15:55
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
Originally Posted by shka View Post
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.
Reply With Quote
  #7  
Old 31 Jan 2019, 16:08
shka shka is offline
 
Join Date: Mar 2016
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
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Administrative and Maintenance Tools Suppress-o-matic - Stop database error spam GeekyDesigns vBulletin 4.x Add-ons 56 27 Jul 2016 20:49
Administrative and Maintenance Tools Suppress-o-Matic - Stop database error spam GeekyDesigns vBulletin 3.8 Add-ons 65 12 Sep 2013 20:01



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 14:36.

Layout Options | Width: Wide Color: