1 頁 (共 1 頁)

[問題]無法註冊?已爬文仍無法解決..(已ok)

發表於 : 2004-03-16 18:04
Andy Lee
●架設主機作業系統:Linux(RedHat 7.2)。
●您的上網方式:Hinet ADSL。
●您安裝的程式:Apache + php + MySql 3.23.56(網站未說明前二項之版本) 。
●您的 phpBB2 版本:phpBB 2.0.6。
●您的 phpBB2 連結網址: http://www.gagawulala.net/phpBB2/。(租用www.iwcash.com之虛擬空間)
●錯誤訊息:

Could not insert data into users table

DEBUG MODE

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

INSERT INTO _users (user_id, username, user_regdate, user_password, user_email, 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 (4, 'mengkuen', 1079430923, '600c52e7da3cf7e7a896d0229e08559b', '008830@ubos.com.tw', '', '', '', '', '', '', '', '', 0, 0, '', '', '', 1, 1, 0, 1, 1, 0, 1, 1, 8, 'D M d, Y g:i a', 'chinese_traditional_taiwan', 1, , '0' 0, 1, 0, '8fa7e9f072')

Line : 538
File : /home/virtual/site2/fst/var/www/html/phpBB2/includes/usercp_register.php



我找遍了所有文章,有很多人都碰到一樣的情形,試了所有方法仍無法解決。
由於我還在架站階段,裝了許多MOD後才發現此情形,只記得有:
Attach-Mod
medal_mod
Advanced_Link
.........
真的不知道哪裡出了問題,有找到一篇小竹子提到可能是SQL控制權的問題,請問要如何確定這方面是否有誤?

各位大大請救我.............. :cry:[quote][/quote]

發表於 : 2004-03-16 18:23
天霜
includes/usercp_register.php第538上下十行列出來一下

並且說你安裝了那些外掛

發表於 : 2004-03-16 19:11
messagebox
'chinese_traditional_taiwan', 1, , '0' 0, 1, 0, '8fa7e9f072')
應該是\r
'chinese_traditional_taiwan', 1, 0, 1, 0, '8fa7e9f072')
自己改錯的吧~~

發表於 : 2004-03-16 21:51
Andy Lee
天霜 寫:includes/usercp_register.php第538上下十行列出來一下
是醬子的:
[php]<?php
//
// Get current date
//
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, 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 ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, , '$gender' 0, 1, ";
if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
{
$user_actkey = gen_rand_string(true);
$key_len = 54 - (strlen($server_url));
$key_len = ( $key_len > 6 ) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
}
else
{
$sql .= "1, '')";
}

if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}

$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
VALUES ('', 'Personal User', 1, 0)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
}

$group_id = $db->sql_nextid();

$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES ($user_id, $group_id, 0)";
if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
}

?>[/php]
我今天大概裝了:
attach_mod v.239
gender_1.2.6en
medal_system_v1.1.1
online/offlin/hidden mod
好像是這些吧!
messagebox 寫:'chinese_traditional_taiwan', 1, , '0' 0, 1, 0, '8fa7e9f072')
應該是
'chinese_traditional_taiwan', 1, 0, 1, 0, '8fa7e9f072')
自己改錯的吧~~
那請問這個要怎麼改回來,謝謝兩位大大!

發表於 : 2004-03-16 22:14
天霜
第538行是那一行?

發表於 : 2004-03-16 22:21
messagebox

代碼: 選擇全部

$user_style, , '$gender' 
怎麼會有2個逗點相連中間卻沒有任何數值呢\r

上面我已經回過了~~~
只是送出SQL命令出錯而已~~~

[php]
536 if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
537 {
538 message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
539 }
[/php]

知道第幾行並不是那麼重要~~~
因為錯誤訊息已經說的很清楚~~~

是SQL語法錯誤~~

依照前後文對應~~~
是修改gender_1.2.6en這個MOD時你做錯了~~~
如果方便~~~~附上你所下載的位置連結一下~~~

大致補上應該修改的方式~~~(因為剛剛看一下資料欄位~)
[php]
user_style, user_level, user_allow_pm //SQL語法
//並沒有gender的欄位
//但你卻在VLAUE的地方\r
$user_style, , '$gender' 0, 1, ";
//插入$gender的值~~~

/*所以需要參考原始檔案~~
大致上就是如下*/
user_style, user_level, user_allow_pm
//改為\r
user_style,gender的欄位 ,user_level, user_allow_pm

$user_style, , '$gender' 0, 1, ";
//改為\r
$user_style, '$gender', 0, 1, ";
[/php]

發表於 : 2004-03-16 22:23
Andy Lee
天霜兄,

謝謝您的提醒,我逮到錯誤了!不過不是在538行,是我在改gender那支mod時改錯了。有兩個地方:

1. 在我上面quote的第9行,在user_style後面忘了加上user_gender。
2.在第19行(第二段最後一行),'$gender'前面有兩個",",應該挪一個到後面。

修正後,就ok了。
謝謝天霜兄!

發表於 : 2004-03-16 22:27
Andy Lee
哈!謝謝messagebox大大,我已經找到錯誤了!
不過您說的SQL語法錯誤是啥意思?不好意思小弟對SQL可說是一竅不通,所以要請教一下,如果遇到SQL語法錯誤的問題時,應該怎麼找錯誤?怎麼去改他?

謝謝!

發表於 : 2004-03-16 22:45
messagebox
Andy Lee 寫:哈!謝謝messagebox大大,我已經找到錯誤了!
不過您說的SQL語法錯誤是啥意思?不好意思小弟對SQL可說是一竅不通,所以要請教一下,如果遇到SQL語法錯誤的問題時,應該怎麼找錯誤?怎麼去改他?

謝謝!
SQL語法錯誤是我自己亂翻譯的~~~
大致上是說~~~對SQL SERVICE送出的命令要求語法不正確~~

以本例子來說~$sql這變數裡存放的就是你對sql所提出的要求命令~~~

INSERT INTO _users (...) VALUE (...);
這就是本例子所送出的要求~~~
因為你的錯誤一眼就看出~~~所以不需要一個一個欄位去檢視~~~
為什麼一眼就看出~~~
因為如果該欄位是無值~~~則需要送一個空字串(EX:'')或NULL
而非, ,來表示無值~~~

仔細一看~
你的欄位跟輸入值的數目不對~~~
表示你一定改錯了~~

SQL回傳You have an error in your SQL syntax near
就是說明送出的要求語法格是不能被SQL正確判讀(我只想的出這樣的解釋)~~
不過他所說的位置~~~ ' '0' 0, 1, 0, '8fa7e9f072')'
通常不一定是正確的~~~
只能說~~~SQL在解譯那段文字時~~
到那邊就判定是錯誤~~~

至於怎麼找錯誤~~~
通常會出現錯誤訊息都有跡可循~~~我也不知道該怎麼說~~~

發表於 : 2004-03-16 22:53
Andy Lee
謝謝messagebox兄,稍微有點概念了,小弟會再努力學習,希望以後也有能力可以幫助別人!

發表於 : 2004-03-21 04:54
無敵肉腳
那請問一下
我這又是什麼情形\r
一般錯誤

Failed sending email :: PHP ::

DEBUG MODE

Line : 234
File : c:\appserv\www\phpbb2\includes\emailer.php

發表於 : 2004-03-21 05:16
aiken
請你自己使用 http://phpbb-tw.net/phpbb/search.php
一定有你要找的答案