The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
mysql_query error number
Hi at all.
I've a small question. How is it possible to not show the db error and another self defined error in vbulletin? My actual code looks like this, but it shows only the default vbulletin database error if an entry is duplicate: PHP Code:
Frexter |
#2
|
||||
|
||||
What 'default' database error? Aren't you getting it emailed to you so you may see the full error?
|
#3
|
|||
|
|||
I think if you call $db->hide_errors() before then query, then $db->show_errors() when you're done, it will turn off the vbulletin error reporting.
|
#4
|
|||
|
|||
For sure i can see the complete database error. But i want to "hide" the database error and display my own error message. But only if the mysql error number is 1062, which is for duplicate key entrys.
--------------- Added [DATE]1360439313[/DATE] at [TIME]1360439313[/TIME] --------------- Thanks kh99, with the hide_errors() function it works. =) |
#5
|
|||
|
|||
If you only want to detect duplicates, maybe you can use INSERT....IGNORE to cause it to ignore duplicates, then check the number of rows to see if it affected 1 or 0 rows (but I haven't tried it so I'm not sure if it works). If it works then you could remove the hide and vbulletin would handle any other errors.
|
#6
|
|||
|
|||
The idea is much better and it works. Thanks again kh99.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|