[問題]RPG資料要如何加入武器防具....

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
Zeans
星球公民
星球公民
文章: 36
註冊時間: 2006-04-08 12:07
來自: 紫願心夢       尋找: 海豚灣戀人       狀態: 當米蟲中@@

[問題]RPG資料要如何加入武器防具....

文章 Zeans »

我想在發表人有武器防具的一些RPG資料

所以自己增加了viewtopic.php

代碼: 選擇全部

'<tr><td><span class="gensmall">左 手:</span></td><td><span class="gensmall">' . $postrow[$i]{RPG_LEFT_HAND} . '</span></td></tr>' . 
'<tr><td><span class="gensmall">右 手:</span></td><td><span class="gensmall">' . $postrow[$i]{RPG_RIGHT_HAND} . '</span></td></tr>' . 
'<tr><td><span class="gensmall">盔 甲:</span></td><td><span class="gensmall">' . $postrow[$i]{RPG_DEFEND} . '</span></td></tr>' . 
'<tr><td><span class="gensmall">腳 部:</span></td><td><span class="gensmall">' . $postrow[$i]{RPG_LEGER} . '</span></td></tr>' .
'<tr><td><span class="gensmall">頭 盔:</span></td><td><span class="gensmall">' . $postrow[$i]{RPG_SAFETY} . '</span></td></tr></table>'; 
都只能顯示左手.右手.....的字而已

武器的名稱都沒有顯示出來

另外我還想加入"人氣指數"
http://202.39.234.25/phpbb/viewtopic.ph ... 7%E6%95%B8

請問哪些地方有錯誤?
煩請指正!!
●架設主機作業系統:windows xp sp2
●空間連結: http://hosting.why3s.com.tw/
●PHPBB3 連結網址:http://freets.why3s.cc/phpBB3/index.php
●上網方式:ADSL
●安裝的程式: php + MySql
●phpBB3 版本:phpBB 3.0.0
頭像
hentaibbc
版面管理員
版面管理員
文章: 342
註冊時間: 2005-09-01 18:01

文章 hentaibbc »

$postrow[$i]
這個東西是php中的變數

{RPG_LEFT_HAND}
而這個呢!是用$template所指定的東西....
是用在tpl中的...

應該要是$postrow[$i]['xxxxx'];
這樣才對...
而且...還要確定你的$postrow是不是有包括了你要的資料了...

這又要回去看你的$sql取值...

這麼說....能了解嗎???
Zeans
星球公民
星球公民
文章: 36
註冊時間: 2006-04-08 12:07
來自: 紫願心夢       尋找: 海豚灣戀人       狀態: 當米蟲中@@

文章 Zeans »

我大部分都搞不懂耶
viewtopic.php是改成這樣嗎?

代碼: 選擇全部

'<tr><td><span class="gensmall">左 手:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_left_hand'] . '</span></td></tr>' . 
'<tr><td><span class="gensmall">右 手:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_right_hand'] . '</span></td></tr>' . 
'<tr><td><span class="gensmall">盔 甲:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_defend'] . '</span></td></tr>' . 
'<tr><td><span class="gensmall">腳 部:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_safety'] . '</span></td></tr>' .
'<tr><td><span class="gensmall">頭 盔:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_leger'] . '</span></td></tr></table>'; 
然後尋找

代碼: 選擇全部

'POSTER_RPG_LEVEL'=> $postrow[$i]['rpg_level'], //RPG's by Yoshikawa 
'POSTER_RPG_MEDALS' => $postrow[$i]['rpg_medals'], //RPG's by Yoshikawa 
'POSTER_RPG_CUR_HP' => $postrow[$i]['rpg_cur_hp'], //RPG's by Yoshikawa 
'POSTER_RPG_CUR_MP'=> $postrow[$i]['rpg_cur_mp'], //RPG's by Yoshikawa 
'POSTER_RPG_SPEED'=> $postrow[$i]['rpg_speed'], //RPG's by Yoshikawa 
'POSTER_RPG_ATTACK'=> $postrow[$i]['rpg_attack'], //RPG's by Yoshikawa 
'POSTER_RPG_DEFENSE'=> $postrow[$i]['rpg_defense'], //RPG's by Yoshikawa 
'POSTER_RPG_CUR_EXP'=> $postrow[$i]['rpg_cur_exp'], //RPG's by Yoshikawa 
後面加上

代碼: 選擇全部

	                'POSTER_RPG_LEFT_HAND' => $postrow[$i]['rpg_left_hand'], 
	                'POSTER_RPG_RIGHT_HAND' => $postrow[$i]['rpg_right_hand'], 
                	'POSTER_RPG_DEFEND' => $postrow[$i]['rpg_defend'], 
                	'POSTER_RPG_SAFETY' => $postrow[$i]['rpg_safety'], 
                	'POSTER_RPG_LEGER' => $postrow[$i]['rpg_leger'], 
至於$sql要怎麼去修改呢?
●架設主機作業系統:windows xp sp2
●空間連結: http://hosting.why3s.com.tw/
●PHPBB3 連結網址:http://freets.why3s.cc/phpBB3/index.php
●上網方式:ADSL
●安裝的程式: php + MySql
●phpBB3 版本:phpBB 3.0.0
頭像
hentaibbc
版面管理員
版面管理員
文章: 342
註冊時間: 2005-09-01 18:01

文章 hentaibbc »

在php檔中
用這樣的方式
$template->assign_vars(array(
"XXXX" => $xxx)
);

然後在對應的tpl檔中
用{XXXX}就可以顯示$xxx的內容...

============================

而$sql怎麼改...
這個請去查書或相關資料吧...
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

Zeans 寫:我大部分都搞不懂耶
viewtopic.php是改成這樣嗎?

代碼: 選擇全部

'<tr><td><span class="gensmall">左 手:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_left_hand'] . '</span></td></tr>' . 
'<tr><td><span class="gensmall">右 手:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_right_hand'] . '</span></td></tr>' . 
'<tr><td><span class="gensmall">盔 甲:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_defend'] . '</span></td></tr>' . 
'<tr><td><span class="gensmall">腳 部:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_safety'] . '</span></td></tr>' .
'<tr><td><span class="gensmall">頭 盔:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_leger'] . '</span></td></tr></table>'; 
然後尋找

代碼: 選擇全部

'POSTER_RPG_LEVEL'=> $postrow[$i]['rpg_level'], //RPG's by Yoshikawa 
'POSTER_RPG_MEDALS' => $postrow[$i]['rpg_medals'], //RPG's by Yoshikawa 
'POSTER_RPG_CUR_HP' => $postrow[$i]['rpg_cur_hp'], //RPG's by Yoshikawa 
'POSTER_RPG_CUR_MP'=> $postrow[$i]['rpg_cur_mp'], //RPG's by Yoshikawa 
'POSTER_RPG_SPEED'=> $postrow[$i]['rpg_speed'], //RPG's by Yoshikawa 
'POSTER_RPG_ATTACK'=> $postrow[$i]['rpg_attack'], //RPG's by Yoshikawa 
'POSTER_RPG_DEFENSE'=> $postrow[$i]['rpg_defense'], //RPG's by Yoshikawa 
'POSTER_RPG_CUR_EXP'=> $postrow[$i]['rpg_cur_exp'], //RPG's by Yoshikawa 
後面加上

代碼: 選擇全部

	                'POSTER_RPG_LEFT_HAND' => $postrow[$i]['rpg_left_hand'], 
	                'POSTER_RPG_RIGHT_HAND' => $postrow[$i]['rpg_right_hand'], 
                	'POSTER_RPG_DEFEND' => $postrow[$i]['rpg_defend'], 
                	'POSTER_RPG_SAFETY' => $postrow[$i]['rpg_safety'], 
                	'POSTER_RPG_LEGER' => $postrow[$i]['rpg_leger'], 
至於$sql要怎麼去修改呢?
建議您:
比照之前的修改

代碼: 選擇全部

#-----[ 打開 ]-----------------------------------------------------------------------
#
viewtopic.php

#
#-----[ 尋找這一段 ]-----------------------------------------------------------------
#
$sql = "SELECT u.username, u.user_id
	FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
	WHERE p.topic_id = $topic_id

#
#-----[ 在 $sql = "SELECT 後面尋找 ]-------------------------------------------------
#
u.user_allowsmile

#
#-----[ 之後, 加上 ]-----------------------------------------------------------------
#
,u.user_robfail, u.rpg_level, u.rpg_cur_hp, u.rpg_max_hp, u.rpg_cur_mp, u.rpg_max_mp, u.rpg_cur_exp, u.rpg_max_exp, u.rpg_attack, u.rpg_defense, u.rpg_magic, u.rpg_speed, u.rpg_medals
再追加幾個 '欄位' 即可.

代碼: 選擇全部

, u.rpg_left_hand, u.rpg_right_hand, u.rpg_defend, u.rpg_safety, u.rpg_leger
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
Zeans
星球公民
星球公民
文章: 36
註冊時間: 2006-04-08 12:07
來自: 紫願心夢       尋找: 海豚灣戀人       狀態: 當米蟲中@@

文章 Zeans »

心靈捕手大大,我已經按照你所說的加上這些

代碼: 選擇全部

, u.rpg_left_hand, u.rpg_right_hand, u.rpg_defend, u.rpg_safety, u.rpg_leger 
但是卻出現下面這樣的錯誤

Could not obtain post/user information.

DEBUG MODE

SQL Error : 1054 Unknown column 'u.rpg_left_hand' in 'field list'

SELECT u.username, u.user_money, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile,u.user_robfail, u.rpg_level, u.rpg_cur_hp, u.rpg_max_hp, u.rpg_cur_mp, u.rpg_max_mp, u.rpg_cur_exp, u.rpg_max_exp, u.rpg_attack, u.rpg_defense, u.rpg_magic, u.rpg_speed, u.rpg_medals, u.rpg_left_hand, u.rpg_right_hand, u.rpg_defend, u.rpg_safety, u.rpg_leger, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid FROM phpbb_posts p, phpbb_users u, phpbb_posts_text pt WHERE p.topic_id = 2 AND pt.post_id = p.post_id AND u.user_id = p.poster_id ORDER BY p.post_time ASC LIMIT 0, 15

Line : 405
File : viewtopic.php

我單純只想把水怪RPG的個人資料上面的左手.右手後面所顯示的東西
圖檔

讓發表人的這個地方也可以顯示出來
圖檔

還請大大指點迷津!!
●架設主機作業系統:windows xp sp2
●空間連結: http://hosting.why3s.com.tw/
●PHPBB3 連結網址:http://freets.why3s.cc/phpBB3/index.php
●上網方式:ADSL
●安裝的程式: php + MySql
●phpBB3 版本:phpBB 3.0.0
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

Zeans 寫:心靈捕手大大,我已經按照你所說的加上這些

代碼: 選擇全部

, u.rpg_left_hand, u.rpg_right_hand, u.rpg_defend, u.rpg_safety, u.rpg_leger 
但是卻出現下面這樣的錯誤

Could not obtain post/user information.

DEBUG MODE

SQL Error : 1054 Unknown column 'u.rpg_left_hand' in 'field list'
抱歉! 我只是針對之前您所做的修改加以判斷,
並沒有深入思考, 以至於出現錯誤. :oops:

建議您:
還原安裝水怪後的 viewtopic.php,
針對您的需求, 重新修改.
如下:
#
#-----[ FIND ]-----
#

代碼: 選擇全部

	$rpgstatus = '<table width="142" cellpadding="0" cellspacing="0" border="0" class="bodyline">' .
			'<tr><td width="35%"><span class="gensmall">職 照:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_medals'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">等 級:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_level'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">H P:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_cur_hp'] . ' / ' . $postrow[$i]['rpg_max_hp'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">M P:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_cur_mp'] . ' / ' . $postrow[$i]['rpg_max_mp'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">經驗值:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_cur_exp'] . ' / ' . $postrow[$i]['rpg_max_exp'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">攻擊力:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_attack'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">防禦力:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_defense'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">魔 力:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_magic'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">速 度:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_speed'] . '</span></td></tr></table>';
#
#-----[ BEFORE, ADD ]-----
#

代碼: 選擇全部

// + 左右手
$righthand = '';
$lefthand = '';

$sql = 'SELECT i.item_name, i.item_position FROM phpbb_rpg_items i, phpbb_rpg_owns o WHERE i.in_which_store = 1 AND i.item_id = o.item_id AND o.user_id = ' . $postrow[$i]['user_id'] . ' ORDER BY i.item_position';
if ( $result = $db->sql_query($sql) )
{
	if ( $row = $db->sql_fetchrow($result) )
	{
		do
		{
			switch ($row['item_position'])
			{
				case 1:
					if ($righthand == '')
					{
						$righthand = $row['item_name'];
					}
					else
					{
						$lefthand = $row['item_name'];
					}
					break;
			}
		}
		while ( $row = $db->sql_fetchrow($result) );
	}
}
// - 左右手
// + 沒光的防具店、水怪的頭盔店、風神的鞋子店
$defend = ''; 
$sql = 'SELECT i.item_name, i.item_position FROM phpbb_rpg_items i, phpbb_rpg_owns o WHERE i.in_which_store = 2 AND i.item_id = o.item_id AND o.user_id = ' . $postrow[$i]['user_id'] . ' ORDER BY i.item_position'; 
if ( $result = $db->sql_query($sql) ) 
{ 
if ( $row = $db->sql_fetchrow($result) ) 
{ 
if ($defend == '') 
{ 
$defend = $row['item_name']; 
} 
} 
} 
$safety = ''; 
$sql = 'SELECT i.item_name, i.item_position FROM phpbb_rpg_items i, phpbb_rpg_owns o WHERE i.in_which_store = 4 AND i.item_id = o.item_id AND o.user_id = ' . $postrow[$i]['user_id'] . ' ORDER BY i.item_position'; 
if ( $result = $db->sql_query($sql) ) 
{ 
if ( $row = $db->sql_fetchrow($result) ) 
{ 
if ($safety == '') 
{ 
$safety = $row['item_name']; 
} 
} 
} 
$leger = ''; 
$sql = 'SELECT i.item_name, i.item_position FROM phpbb_rpg_items i, phpbb_rpg_owns o WHERE i.in_which_store = 5 AND i.item_id = o.item_id AND o.user_id = ' . $postrow[$i]['user_id'] . ' ORDER BY i.item_position'; 
if ( $result = $db->sql_query($sql) ) 
{ 
if ( $row = $db->sql_fetchrow($result) ) 
{ 
if ($leger == '') 
{ 
$leger = $row['item_name']; 
} 
} 
} 
// - 沒光的防具店、水怪的頭盔店、風神的鞋子店
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

	$rpgstatus = '<table width="142" cellpadding="0" cellspacing="0" border="0" class="bodyline">' .
			'<tr><td width="35%"><span class="gensmall">職 照:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_medals'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">等 級:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_level'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">H P:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_cur_hp'] . ' / ' . $postrow[$i]['rpg_max_hp'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">M P:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_cur_mp'] . ' / ' . $postrow[$i]['rpg_max_mp'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">經驗值:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_cur_exp'] . ' / ' . $postrow[$i]['rpg_max_exp'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">攻擊力:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_attack'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">防禦力:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_defense'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">魔 力:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_magic'] . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">速 度:</span></td><td><span class="gensmall">' . $postrow[$i]['rpg_speed'] . '</span></td></tr>' .
			'<tr><td><span class="gensmall">左 手:</span></td><td><span class="gensmall">' . $lefthand . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">右 手:</span></td><td><span class="gensmall">' . $righthand . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">頭 盔:</span></td><td><span class="gensmall">' . $safety . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">盔 甲:</span></td><td><span class="gensmall">' . $defend . '</span></td></tr>' . 
			'<tr><td><span class="gensmall">腳 部:</span></td><td><span class="gensmall">' . $leger . '</span></td></tr></table>';
ps.
如果論壇文章很多的話, 那麼資料庫作業會很吃重.
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
Zeans
星球公民
星球公民
文章: 36
註冊時間: 2006-04-08 12:07
來自: 紫願心夢       尋找: 海豚灣戀人       狀態: 當米蟲中@@

文章 Zeans »

謝謝心靈捕手大大

現在這些資料都能夠正常的顯示了!!
●架設主機作業系統:windows xp sp2
●空間連結: http://hosting.why3s.com.tw/
●PHPBB3 連結網址:http://freets.why3s.cc/phpBB3/index.php
●上網方式:ADSL
●安裝的程式: php + MySql
●phpBB3 版本:phpBB 3.0.0
jwxinst
竹貓忠實會員
竹貓忠實會員
文章: 945
註冊時間: 2006-03-31 10:07
來自: New York, USA     學業狀況: 當天才...       個人狀況: 臭蛋
聯繫:

文章 jwxinst »

如果允許我在這裡插嘴的話, 那我必需要把老師的話再補上一句
●免費空間連結: http://www.pandela.com/

這個免空只有2mb的資料庫容量

如果你目前是用他來做測試論壇, 看看自己的能力而已那當然沒問題
但是如果你想用他當比較久一點的小論壇, 請小心點喔

ps: 流量他們都可以說是騙人
到了很高的時候, 他們自然會把他砍掉.....

這是我想補充的一點
ps; 電腦壞, 只能上來看xdddd
目前狀態圖檔
GoKo Music進度: 10%

問個問題不要緊可是沒有發文格式、問題不夠詳細情況,難道要用猜嗎?
新手必讀
[教學] 基本認識、學習、隨我架設phpBB的新手通 -更新至2.0.22
問問題的技巧
http://www.phpbb-tw.net/phpbb/viewtopic.php?t=44340
MOD安裝教學及轉碼
http://www.phpbb-tw.net/phpbb/viewtopic.php?t=22832
Zeans
星球公民
星球公民
文章: 36
註冊時間: 2006-04-08 12:07
來自: 紫願心夢       尋找: 海豚灣戀人       狀態: 當米蟲中@@

文章 Zeans »

謝謝您的提醒!!

這個論壇我只是要拿來當作班網的事情

以及放一些要討論的報告用
●架設主機作業系統:windows xp sp2
●空間連結: http://hosting.why3s.com.tw/
●PHPBB3 連結網址:http://freets.why3s.cc/phpBB3/index.php
●上網方式:ADSL
●安裝的程式: php + MySql
●phpBB3 版本:phpBB 3.0.0
jwxinst
竹貓忠實會員
竹貓忠實會員
文章: 945
註冊時間: 2006-03-31 10:07
來自: New York, USA     學業狀況: 當天才...       個人狀況: 臭蛋
聯繫:

文章 jwxinst »

不用, 因為以前是免空組XDDDD最爽是把免空罵過堂

嗯, 那就好^^
記得備份喔
目前狀態圖檔
GoKo Music進度: 10%

問個問題不要緊可是沒有發文格式、問題不夠詳細情況,難道要用猜嗎?
新手必讀
[教學] 基本認識、學習、隨我架設phpBB的新手通 -更新至2.0.22
問問題的技巧
http://www.phpbb-tw.net/phpbb/viewtopic.php?t=44340
MOD安裝教學及轉碼
http://www.phpbb-tw.net/phpbb/viewtopic.php?t=22832
主題已鎖定

回到「外掛問題討論」