第 1 頁 (共 1 頁)
[問題] 刪文出現錯誤(已解決,謝謝)
發表於 : 2005-08-25 03:53
由 cloudsnow30
代碼: 選擇全部
一般錯誤
Error in posting
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 '0 WHERE user_id = 2' at line 2
UPDATE phpbb_users SET user_posts = user_posts 0 WHERE user_id = 2
Line : 489
File : functions_post.php
貼在這裡不曉得對不對...
基本上發文.都沒什麼問題...
唯獨刪文時都會出現以上錯誤訊息..
回到版面上文章也有刪除成功..
但是總覺得怪怪的..
煩請大大幫忙看看..
所有版面皆可留言
問題論壇:
http://sakurmoon.no-ip.info/sakurai/
測試帳密 123/123
以安裝過的外掛
快速回覆.
附加檔案
推薦網站
強制主題類型
公告置頂分區
文章強迫斷行
訪客可看標題,不可看內容
發表於 : 2005-08-25 12:52
由 kp3011
functions_post.php 第 489 行 上 幾 行 有 一 行
SET user_posts = user_posts 0 WHERE user_id =
改 成
SET user_posts = user_posts - 1 WHERE user_id =
發表於 : 2005-08-25 14:49
由 cloudsnow30
kp3011 寫:functions_post.php 第 489 行 上 幾 行 有 一 行
SET user_posts = user_posts 0 WHERE user_id =
改 成
SET user_posts = user_posts - 1 WHERE user_id =
找了一下.並沒有發現這句...
還是想不出來哪裡有錯...
附上該檔案的程式碼..
麻煩大大幫忙看看
代碼: 選擇全部
function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
{
global $db;
$sign = ($mode == 'delete') ? '- 1' : '+ 1';
///
/// Begin edit
///
$edited_sign = ($mode == 'delete') ? '0' : '+ 1';
///
/// End edit
///
$forum_update_sql = "forum_posts = forum_posts $sign";
$topic_update_sql = '';
if ($mode == 'delete')
{
if ($post_data['last_post'])
{
if ($post_data['first_post'])
{
$forum_update_sql .= ', forum_topics = forum_topics - 1';
}
else
{
$topic_update_sql .= 'topic_replies = topic_replies - 1';
$sql = "SELECT MAX(post_id) AS last_post_id
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$topic_update_sql .= ', topic_last_post_id = ' . $row['last_post_id'];
}
}
if ($post_data['last_topic'])
{
$sql = "SELECT MAX(post_id) AS last_post_id
FROM " . POSTS_TABLE . "
WHERE forum_id = $forum_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$forum_update_sql .= ($row['last_post_id']) ? ', forum_last_post_id = ' . $row['last_post_id'] : ', forum_last_post_id = 0';
}
}
}
else if ($post_data['first_post'])
{
$sql = "SELECT MIN(post_id) AS first_post_id
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['first_post_id'];
}
}
else
{
$topic_update_sql .= 'topic_replies = topic_replies - 1';
}
}
else if ($mode != 'poll_delete')
{
$forum_update_sql .= ", forum_last_post_id = $post_id" . (($mode == 'newtopic') ? ", forum_topics = forum_topics $sign" : "");
$topic_update_sql = "topic_last_post_id = $post_id" . (($mode == 'reply') ? ", topic_replies = topic_replies $sign" : ", topic_first_post_id = $post_id");
}
else
{
$topic_update_sql .= 'topic_vote = 0';
}
$sql = "UPDATE " . FORUMS_TABLE . " SET
$forum_update_sql
WHERE forum_id = $forum_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
if ($topic_update_sql != '')
{
$sql = "UPDATE " . TOPICS_TABLE . " SET
$topic_update_sql
WHERE topic_id = $topic_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}
if ($mode != 'poll_delete')
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts $edited_sign
WHERE user_id = $user_id";
if (!$db->sql_query($sql, END_TRANSACTION))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}
return;
}
發表於 : 2005-08-25 14:51
由 kp3011
$edited_sign = ($mode == 'delete') ? '0' : '+ 1'
轉 為\r
$edited_sign = ($mode == 'delete') ? '- 1' : '+ 1'
發表於 : 2005-08-25 15:08
由 ~倉木麻衣~
cloudsnow30 寫:找了一下.並沒有發現這句...
還是想不出來哪裡有錯...
附上該檔案的程式碼..
麻煩大大幫忙看看
幫你修改內容
下回請貼重點部份就好了, 儘量不要把整個檔案一股腦的全貼上來
發表於 : 2005-08-25 17:41
由 cloudsnow30
~倉木麻衣~ 寫:cloudsnow30 寫:找了一下.並沒有發現這句...
還是想不出來哪裡有錯...
附上該檔案的程式碼..
麻煩大大幫忙看看
幫你修改內容
下回請貼重點部份就好了, 儘量不要把整個檔案一股腦的全貼上來
真是抱歉..
因為不知哪個部分有問題.
所以只好全貼.
下次我會注意的..
抱歉..抱歉...