Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-02-2003, 09:20 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default db error

I got this db error earlier tonight and was wondering if someone could please tell me what it means?

Quote:
[disable]Database error in vBulletin 2.2.9:

Invalid SQL: UPDATE user SET signature='\"Everybody wants to go to heaven, but nobody wants to die.\"

~Boofo\'s Babe~
' WHERE userid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

Date: Thursday 02nd of January 2003 10:33:48 AM
Script: http://www.bearfacts2.com/forum/forum/sedit.php
Referer: http://www.bearfacts2.com/forum/sedit.php
[/disable]
The file in question is a signature editing file. Here is the code I thought was causing it:

Code:
if ($action=="SaveChanges") {
  $newsignature=censortext($signatureform);
  $DB_site->query("UPDATE user SET signature='".addslashes($newsignature)."' WHERE userid=$bbuserid");
and here is what I changed it to:

Code:
if ($action=="SaveChanges") {
  $newsignature=censortext($signatureform);
  $DB_site->query("UPDATE user SET signature='".addslashes($newsignature)."' WHERE userid='$bbuserinfo[userid]'");
The reason I changed "userid=$bbuserid" to "userid='$bbuserinfo[userid]'" was because in 2 other places in the same file on db queries they were using "userid='$bbuserinfo[userid]'" and not just userid=$bbuserid. Would that make a difference?
Reply With Quote
  #2  
Old 01-02-2003, 01:40 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$bbuserid is just defined in a cookie, and is never globalized in anyfunctions, $bbuserinfo['userid'] is defined nearly boardwide so you should always use this
Reply With Quote
  #3  
Old 01-02-2003, 01:47 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Was that what caused the db error then? The apostrophe in the name wouldn't have had anything to do with it, would it? I don't know why they used "$bbuserinfo['userid']" when calling info from the database and used "$bbuserid" to write it back. I guess I need to know if I fixed it by changing that variable or will I have problems on down the road somewhere with it?
Reply With Quote
  #4  
Old 01-02-2003, 01:59 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the userid, has no appostrophe in it

always use bbuserinfo[userid], i think that bbuserid was producing the error
Reply With Quote
  #5  
Old 01-02-2003, 02:15 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, sir. That was what I needed to hear. What I don't get is when I was running that same file on v2.2.5, it worked fine and I never got an error with it.
Reply With Quote
  #6  
Old 01-02-2003, 02:39 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i think vb225 has globalized also bbuserid, not sure, but i could be that...
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 10:49 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04297 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete