Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
SQL Error
Post new topic   Reply to topic View previous topic :: View next topic
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
SQL Error
PostPosted: 11/02/2006 3:55 PM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:59 AM
greatbrE.gif
I'm trying to add the IP log on Registration mod and the SQL query to be added was - ALTER TABLE phpbb_users ADD user_regip CHAR(8) NOT NULL DEFAULT '0';

I've done it but I get this error - Could not insert data into users table

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near '', '54435240, '', '', '', '', '', '', '', '', 0, 0, '', '', '', 1, 1, 0, 1, 1, 0' at line 2

INSERT INTO phpbb_users (user_id, username, user_regdate, user_password, user_email, user_birthday, user_regip, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey) VALUES (249, 'Blah', 1162499829, 'cbd44f8b5b48a51f7dab98abcdf45d4e', 'babydreamzguardian@gmail.com', 02031980', '54435240, '', '', '', '', '', '', '', '', 0, 0, '', '', '', 1, 1, 0, 1, 1, 0, 1, 0, -1, 'D M d, Y g:i a', 'english', 2, 0, 1, 1, '')

Line : 677
File : usercp_register.php

I think I know what I might of done wrong - when it came to add the query - there was a choice of fields and I left it at as user_id (as seen in the screen shot)
How can I put it right, I'm wary of making it worse!



Thanks  Very Happy
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL Error
PostPosted: 11/02/2006 10:43 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:59 AM
Location: St Pete, FL
peace.gif
Here is the problem.  The new field is a Char (text) field and is expecting the same.  The SQL query attempts to pass this value to the new field:  '54435240,.  Notice that the end quote is missing just before the comma?  So the MOD code added to the usercp_register.php file is missing that second quote mark.  Do you need help finding this error or do you have a good idea of how to tackle it???

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: SQL Error
PostPosted: 11/03/2006 11:24 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:59 AM
greatbrE.gif
Ooh I will have a look and see if I can find it - thanks  headbang
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL Error
PostPosted: 11/03/2006 12:07 PM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:59 AM
greatbrE.gif
Actually - I can't find it, or at least I'm not sure what I'm looking for  Embarassed
I thought I might but I could do with some help please Very Happy

The code added to that file is

Code:
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
# this is only a partial match
#
         $sql = "INSERT INTO " . USERS_TABLE . "
#
#-----[ IN-LINE FIND ]---------------------------------
#
 user_icq,
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------
#
 user_regip,
#
#-----[ FIND ]------------------------------------------
# this is only a partial match
#
            VALUES ($user_id,
#
#-----[ IN-LINE FIND ]---------------------------------
#
 . "', '" . str_replace("\'", "''", $icq)
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------
#
 . "', '" . $userdata['session_ip']
#
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL Error
PostPosted: 11/03/2006 8:25 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:59 AM
Location: St Pete, FL
peace.gif
There were actually two errors in that SQL statement, so after fixing one, there was a new one that needed to be fixed.  This is what I did...

Ok, do this:

OPEN
includes/usercp_register.php

FIND
Code:
'" . $userdata['session_ip'] . ",

REPLACE WITH
Code:
'" . $userdata['session_ip'] . "'

FIND
Code:
" . sprintf('%02d%02d%04d',$bday_month,$bday_day,$bday_year) . "',

REPLACE WITH
Code:
'" . sprintf('%02d%02d%04d',$bday_month,$bday_day,$bday_year) . "',

All seems to be working correctly now.  I successfully registered Test2 on your board...

headbang
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: SQL Error
PostPosted: 11/04/2006 4:55 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:59 AM
greatbrE.gif
Thanks so much for doing that!

headbang  headbang  headbang
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL Error
PostPosted: 11/04/2006 8:31 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:59 AM
Location: St Pete, FL
peace.gif
You are very welcome Karen...

Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
All times are GMT - 5 Hours

Page 1 of 1


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.0842s (PHP: 63% - SQL: 37%) - SQL queries: 48 - GZIP disabled - Debug on