vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   db error (https://vborg.vbsupport.ru/showthread.php?t=47248)

Boofo 01-02-2003 09:20 AM

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?

Xenon 01-02-2003 01:40 PM

$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

Boofo 01-02-2003 01:47 PM

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? :)

Xenon 01-02-2003 01:59 PM

the userid, has no appostrophe in it ;)

always use bbuserinfo[userid], i think that bbuserid was producing the error

Boofo 01-02-2003 02:15 PM

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. :)

Xenon 01-02-2003 02:39 PM

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


All times are GMT. The time now is 08:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01549 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete