1 頁 (共 1 頁)

[問題] 一個錯誤, 不知道如何解決?

發表於 : 2005-05-24 21:00
chsa
問題外掛:無\r
參考連結:無
使用版本:phpBB 2.0.14
網站位置:http://chsa.bounceme.net/phpbb2/portal.php
安裝外掛:貨幣系統 2.2.2, 註冊時間為 15 秒, 偽子分區 2.0.1, 報到系統, 主題類型, Links mod 1.2.2, WIO User Icon, Advanced Quick Reply Mod 1.1.1, 系統文章強迫斷行, ezportal 2.1.8, Forum_Information - 1.0.1, 進階快速回覆, Bank 銀行 V3, 在ezportal中加入最多發文者, Generation Time 2.0.0, 付費瀏覽 1.0.9, 多國語言修正, session force, Recent Topics Block for Smartor's ezPortal, 在入口加入 top5, Fix message_die, Hide Mode for 2.0.4, 增加版權說明, 增加樓層顯示, Reply BACKGROUND, i-Forum Rule, 與版面管理原增加水平線, 個人小檔案修改.
狀況描述:


建立版面時就跑出這個了?!

代碼: 選擇全部

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 ''版面規則', 0, 0, 0, 0, 0, 1

INSERT INTO phpbb_forums (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate) VALUES ('20', '版名', 1, ' ', 40, 0'版面規則', 0, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1)

發表於 : 2005-05-24 21:47
神川小羽
這段出錯了
('20', '版名', 1, ' ', 40, 0'版面規則', 0, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1)
應該是\r
('20', '版名', 1, ' ', 40, 0,'版面規則', 0, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1)
你這訊息似乎少了一些,在這查詢句應該會回傳錯誤的檔名跟行數吧\r
你打開
/admin/admin_forums.php
找到\r

代碼: 選擇全部

			$sql = "INSERT INTO " . FORUMS_TABLE . " (
一直到下2~3行的

代碼: 選擇全部

			if( !$result = $db->sql_query($sql) )
這部份的內容複製在po上來吧。

發表於 : 2005-05-24 21:52
chsa
謝謝您的幫忙!!

代碼: 選擇全部

$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable" . $field_sql . ")
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . "'" . str_replace("\'", "''", $HTTP_POST_VARS['forumrule']) . "', " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
			if( !$result = $db->sql_query($sql) )

發表於 : 2005-05-24 22:00
神川小羽
改成這樣\r
找到\r

代碼: 選擇全部

$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable" . $field_sql . ") 
            VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . "'" . str_replace("\'", "''", $HTTP_POST_VARS['forumrule']) . "', " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
取代\r

代碼: 選擇全部

$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable" . $field_sql . ") 
            VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . "'," . str_replace("\'", "''", $HTTP_POST_VARS['forumrule']) . "', " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
不知道有沒有弄錯,我在第6個值後面加入一個逗號你試看看。

發表於 : 2005-05-24 22:04
ethan
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ",'" . str_replace("\'", "''", $HTTP_POST_VARS['forumrule']) . "', " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
if( !$result = $db->sql_query($sql) )
少了個逗號

發表於 : 2005-05-24 22:06
chsa
謝謝神川小羽的回覆, 但還是沒辦法

後來跳出\r

代碼: 選擇全部

Couldn't insert row in forums 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 '',XXX', 0, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1)' at lin

INSERT INTO phpbb_forums (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate) VALUES ('20', ' XXX', 1, 'XXX ', 40, 0', XXXX', 0, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1)

Line : 402
File : admin_forums.php
另一位大大的改法還要在試試看

發表於 : 2005-05-24 22:10
神川小羽
撲~~果然我放錯了,難怪覺得怪怪的,把第6個之後的逗號移到單引號前面應該就好了。

發表於 : 2005-05-24 22:11
chsa
ethan 寫:
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_rule, prune_enable" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ",'" . str_replace("\'", "''", $HTTP_POST_VARS['forumrule']) . "', " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
if( !$result = $db->sql_query($sql) )
少了個逗號
成功了!! 感謝神川小羽和ethan前輩