 | SQL Error |  |
Posted: 11/02/2006 3:55 PM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 10:59 AM
|

|
|
|
|
 |
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  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL Error |  |
Posted: 11/02/2006 10:43 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 6:59 AM
Location: St Pete, FL
|

|
|
|
|
 |
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???
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL Error |  |
Posted: 11/03/2006 11:24 AM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 10:59 AM
|

|
|
|
|
 |
Ooh I will have a look and see if I can find it - thanks  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL Error |  |
Posted: 11/03/2006 12:07 PM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 10:59 AM
|

|
|
|
|
 |
Actually - I can't find it, or at least I'm not sure what I'm looking for
I thought I might but I could do with some help please
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 |
|
|
 | Re: SQL Error |  |
Posted: 11/03/2006 8:25 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 6:59 AM
Location: St Pete, FL
|

|
|
|
|
 |
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...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL Error |  |
Posted: 11/04/2006 4:55 AM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 10:59 AM
|

|
|
|
|
 |
Thanks so much for doing that!
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL Error |  |
Posted: 11/04/2006 8:31 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 6:59 AM
Location: St Pete, FL
|

|
|
|
|
 |
You are very welcome Karen...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Information |  |
|