Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 01-24-2003, 04:31 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 just got the following error while trying to send a private message. Can someone please tell me what is happening here and maybe how to fix it?

Quote:
Database error in vBulletin 2.2.9:

Invalid SQL: INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid,receipt,attachmentid,showimage) VALUES (NULL,28,28,1,'try again','If you get a chance, can you please try what you did before again? Also, did you get a \"page not found\" or \"this page can not be displayed\" error?',1043389319,'1','0',0,0,1,0,)
mysql error: You have an error in your SQL syntax near ')' at line 1

mysql error number: 1064

Date: Friday 24th of January 2003 06:21:59 AM
Script: http://www.bearfacts2.com/forum/forum/private.php
Referer: http://www.bearfacts2.com/forum/private.php
Reply With Quote
  #2  
Old 01-24-2003, 11:29 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

look at the end: "0,1,0,)"

you hav a , where it shouldn't be
Reply With Quote
  #3  
Old 01-24-2003, 11:54 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No matter who tries to send a pm, they get a db error now. Here's the code in question:

Code:
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt,attachmentid,showimage) VALUES (NULL,$touserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time().",'$signature','$iconid',0,0,$receipt,$attachmentid,$showimage)");
Reply With Quote
  #4  
Old 01-24-2003, 03:55 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

seems the showimage makes problems..

change it to:
PHP Code:
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt,attachmentid,showimage) VALUES (NULL,$touserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time().",'$signature','$iconid',0,0,$receipt,$attachmentid,".intval($showimage).")"); 
Reply With Quote
  #5  
Old 01-24-2003, 04:55 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did this and it now seems to work. But is this the right way to do it or should I change it to what you have in the post abaove?

PHP Code:
 $DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,showimage,iconid,messageread,folderid,receipt,attachmentid) VALUES (NULL,$touserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time().",'$signature','$showimage','$iconid',0,0,$receipt,$attachmentid)"); 
I also moved it in the lines, but I don't think it really matters where it is at in there, does it?
Reply With Quote
  #6  
Old 01-24-2003, 09:35 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no it doesn't matter where in the string it is...

well, your and my query are different.
yours hasn't the hack in anymore, mine would work with the hack (whichone it ever was?)

so if you don't need the hack yours is correct, if it's a needed hack you should use mine
Reply With Quote
  #7  
Old 01-24-2003, 10:57 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The hack is still in there. I moved it behind showsignature and '$signature'. All I did was change $showimage to '$showimage' and it started working. What I was asking is am I going to have problems somewhere else with that change? What does ".intval($showimage)." do that '$showimage' doesn't do, or vice-versa?
Reply With Quote
  #8  
Old 01-25-2003, 11:11 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well it depends on how you save the value in the db.

lets say $showimage is an empty string, then '$showimage' would become '', intval($showimage) would become that: 0

so if you save in the db as integer, you should use intval
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:19 PM.


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.03888 seconds
  • Memory Usage 2,233KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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