|
 |
|
|
05-05-2006, 10:58 PM
|
Syntax error
|
Posts: 151
Name: Viki
Location: West Yorkshire
|
I'm not sure if this should go in the PHP or mysql section, so apologies if this is in the wrong place.
Can anyone help me hunt down the syntax error in the following bit of code:
PHP Code:
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_birthday = '$birthday', user_next_birthday_greeting = '$next_birthday_greeting', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', '" . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . ", user_country = '" . str_replace("\'", "''", $user_country) . "'
__________________
Please login or register to view this content. Registration is FREE - Reality TV videos, news and opinions.
Please login or register to view this content. Registration is FREE - Bargains from a dedicated UK bargain hunter.
|
|
|
|
05-06-2006, 03:06 AM
|
Re: Syntax error
|
Posts: 1,226
Name: Mike
Location: Mataro, Spain
|
What is the resulting query, after substituting all variables?
|
|
|
|
05-06-2006, 10:48 AM
|
Re: Syntax error
|
Posts: 151
Name: Viki
Location: West Yorkshire
|
I don't think I quite understand that question heh
I should have been clearer in my question, so further info....the problem I am having is with my phpBB forum, users cannot edit their profiles...if they try they get an error message similar to the following.
Quote:
Could not update users table
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''', user_attachsig = 1, user_allowsmile = 1, user_allowhtml = 1, user_allowbbcod' at line 2
UPDATE phpbb_users SET user_email = 'georgefierce@hotmail.com', user_icq = '', user_website = 'http://georgie.wildmoonflower.com', user_occ = 'playing guitar', user_from = 'in your imagination...', user_interests = 'music, html, website design, music, punk rock, music, music, MUSIC!', user_birthday = '7759', user_next_birthday_greeting = '2007', user_sig = '[img:1813a03481]http://thesmilies.com/smilies/edible/lemon.gif[/img:1813a03481][img:1813a03481]http://tinypic.com/taoqb6.jpg[/img:1813a03481] nyum nyum nyum moon over marin [img:1813a03481]http://www.swayforum.com/other/collapsechamp.gif[/img:1813a03481] [img:1813a03481]http://i1.tinypic.com/v7cjzb.jpg[/img:1813a03481]', user_sig_bbcode_uid = '1813a03481', user_viewemail = 1, user_aim = 'fishyrockstar', user_yim = '', user_msnm = '', '', user_attachsig = 1, user_allowsmile = 1, user_allowhtml = 1, user_allowbbcode = 1, user_allow_viewonline = 1, user_notify = 0, user_notify_pm = 1, user_popup_pm = 1, user_timezone = -8, user_dateformat = 'D M d, Y g:i a', user_lang = 'english', user_style = 36, user_active = 1, user_actkey = '', user_avatar = 'http://i2.tinypic.com/xawikx.jpg', user_avatar_type = 2, user_country = 'usa' WHERE user_id = 62
Line : 602
File : usercp_register.php
|
I found the bit of code in usercp_register.php where I think the error is (the code I posted above) but I can't work out quite what the problem is, though I expect it to be somwhere around either the 'birthday' part or the 'country' part as those were to do with hacks we added.
__________________
Please login or register to view this content. Registration is FREE - Reality TV videos, news and opinions.
Please login or register to view this content. Registration is FREE - Bargains from a dedicated UK bargain hunter.
Last edited by VToria; 05-06-2006 at 10:50 AM..
|
|
|
|
05-06-2006, 11:27 AM
|
Re: Syntax error
|
Posts: 1,626
Location: Guildford, UK
|
In the SQL, here's your problem:
Code:
user_msnm = '', '', user_attachsig = 1,
In the PHP that's:
Code:
user_msnm = '" . str_replace("\'", "''", $msn) . "', '" . "', user_attachsig =
Basically it doesn't know what to do with the code that I've highlighted in red. It's generating a single pair of quotes without anything else to tell it what to do with them. I'm guessing that it should either be somefieldname = '' or just not be there at all.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|
|
|
|
05-06-2006, 11:41 AM
|
Re: Syntax error
|
Posts: 151
Name: Viki
Location: West Yorkshire
|
SUPERSTAR! Thanks so much, that has got it 
__________________
Please login or register to view this content. Registration is FREE - Reality TV videos, news and opinions.
Please login or register to view this content. Registration is FREE - Bargains from a dedicated UK bargain hunter.
|
|
|
|
|
« Reply to Syntax error
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|