我试图通过口袋妖怪的名称和类型来显示游戏中某个口袋妖怪的数量,(有两种类型正常和闪亮)我希望它只抓住一种难以解释的类型......对现在它抓住了这两种类型,我不知道为什么这是我的代码:/
$sql23 = "
SELECT * FROM user_pokemon
WHERE belongsto='". $_SESSION['username']."'AND (slot='1')
";
$result = mysql_query("
SELECT * FROM user_pokemon
WHERE belongsto='". $_SESSION{'username'}."'AND (slot='1')
");
while($row = mysql_fetch_array($result))
{
$sql = "SELECT * FROM pokemon WHERE name='".$row['pokemon']."'";
$result = mysql_query($sql) or die(mysql_error());
$battle_get = mysql_fetch_array($result);
$count = mysql_query("
SELECT count(*) FROM user_pokemon WHERE pokemon='".$row['pokemon']."
'AND type='".$row['type']."'
");
$count2 = mysql_fetch_array($count);
老实说,我不明白为什么它不起作用,任何帮助将不胜感激:)
$row['pokemon']
是口袋妖怪的名字
$row['type']
是口袋妖怪的类型(闪亮、正常等)
user_pokemon
表问:
Field Type Null Default Comments
-----------------------------------------------------------
id int(11) No
hp int(55) No 30
pokemon varchar(50) No
belongsto varchar(50) No
exp int(50) No 500
item varchar(50) No No Item
nickname varchar(50) No No Nickname
move1 varchar(50) No Ember
move2 varchar(50) No Ember
move3 varchar(50) No Ember
move4 varchar(50) No Ember
slot int(50) No
level int(90) No 5
time_stamp timestamp No CURRENT_TIMESTAMP
gender varchar(25) No Male
type varchar(55) No Normal Type: normal/shiny etc
safari_zone int(10) No 0