安裝mod:快速回覆、彈跳視窗
檔案:viewtopic.php 裡的快速回覆部分
目標:想讀出發表主題者的名字
問題:一直讀不出發表主題者的名字,我想可能是SQL寫錯了
希望有近來瀏覽的大大能幫我看一下,糾正我的錯誤
(紅色部分是我自己寫進去要讀取的SQL碼)
/* BEGIN Quick Reply */
if ($is_auth['auth_reply'] == true)
{
$quick_reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['quick_reply'];
$quick_reply_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Quick_Reply_to_topic'];
if ( !$userdata['session_logged_in'] )
{
$template->assign_block_vars('switch_username_field', array());
}
$sqlstr= "SELECT u.user_id,u.username,p.* FROM ". USERS_TABLE ."u,". POSTS_TABLE ."p WHERE p.post_id=1 AND p.poster_id=u.user_id" ;
$res=$db->sql_query("$sqlstr");
$row=$db->sql_fetchrow($res);
$name=$row['username'];
$template->assign_block_vars('quick_reply', array(
'QUOTE_IMG' => $quote_img,
'QUICK_REPLY_IMG' => $quick_reply_img,
'L_QUICK_REPLY_TOPIC' => $quick_reply_alt,
'L_EMPTY_MESSAGE' => $lang['Empty_message'],
'U_NAME'=>$name,
'U_QUICK_REPLY' => append_sid('privmsg.' . $phpEx),
'U_HIDDEN_FORM_FIELDS' => ( ($userdata['user_attachsig'] ? '<input type="hidden" name="attach_sig" value="1" />' : "") .
($userdata['user_notify'] ? '<input type="hidden" name="notify" value="1" />' : "") . '<input type="hidden" name="mode" value="reply" />
<input type="hidden" name="post" value="1"/>
<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" /> <input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />' )));
}
/* END Quick Reply */
[問題] 請教viewtopic.php片段的自己所加的SQL片段語法(已解決~~)
版主: 版主管理群
[問題] 請教viewtopic.php片段的自己所加的SQL片段語法(已解決~~)
最後由 age0521 於 2006-09-23 23:55 編輯,總共編輯了 1 次。
這裡請加上空格...$sqlstr= "SELECT u.user_id,u.username,p.* FROM ". USERS_TABLE ."u,". POSTS_TABLE ."p WHERE p.post_id=1 AND p.poster_id=u.user_id" ;
代碼: 選擇全部
USERS_TABLE ." u,". POSTS_TABLE ." p代碼: 選擇全部
SELECT u.user_id,u.username,p.* FROM phpbb_usersu,phpbb_postsp WHERE p.post_id=1 AND p.poster_id=u.user_id另外...
$res=$db->sql_query("$sqlstr");
這個用
$res=$db->sql_query($sqlstr);
這樣就可以了...

