0

好吧,所以我正在制作一个基于网络的 rpg 宠物小精灵,它一直都很好,除了我需要将存储在插槽 (0) 中的口袋妖怪切换到你的盒子上的插槽 1 的部分。团队。我已经想通了,它会将存储在插槽 0 中的口袋妖怪切换到您团队的插槽 1,但它仅适用于插槽 0 列表中的第一个(插槽设置为 0 的多个)我希望我正在制作感觉我需要它,以便我可以单击您盒子中任何口袋妖怪下的提交,它会将那个发送到插槽 1 这是我到目前为止的代码:

 <?php
include 'core/database/connect.php';
include 'core/init.php';
protect_page();
include 'includes/overall/header.php';
?>

<div id="middle">
<div class="post">
<div class="postheader">
<h1>Your Box</h1>
</div>
<div class="postcontent">
<p>
<center>

<?php
if (isset($_POST['slot1'])) {

session_start();


// here we grab the pokemon in slot 1 
$sql66 = "SELECT * FROM user_pokemon WHERE
belongsto='".$_SESSION['username']."'
AND (slot='1')";
$result66 = mysql_query($sql66) or die(mysql_error());
$poke66 = mysql_fetch_array($result66);


$sql55 = "SELECT * FROM user_pokemon WHERE
belongsto='".$_SESSION['username']."'
AND (slot='0')";
$result55 = mysql_query($sql55) or die(mysql_error());
$poke55 = mysql_fetch_array($result55);


$_SESSION['idpoke5'] = $poke55['id'] ;

$_SESSION['idpoke6'] = $poke66['id'] ;

if(mysql_num_rows($result66)==0){
echo "no pokemon in slot 6 so we will drag the pokemon from slot 5 into slot 6 ";

} else {
$result666 = mysql_query("UPDATE user_pokemon SET slot=slot-1 WHERE id =  '{$_SESSION['idpoke6']}'")
or die(mysql_error());
header( 'Location: index.php' ) ;


}

if(mysql_num_rows($result55)==0){
echo "no pokemon in slot 5";

} else {

$result5done = mysql_query("UPDATE user_pokemon SET slot=slot+1 WHERE id =  '{$_SESSION['idpoke5']}'")
or die(mysql_error());
}

?>

<?php

 echo "Your pokemon has been moved";
 }
$result = mysql_query("SELECT * FROM user_pokemon WHERE belongsto='".  $_SESSION{'username'}."'AND (slot='0')");
while($row = mysql_fetch_array($result))
{   
$sql2 = "SELECT * FROM pokemon WHERE name='".$row['pokemon']."'";
$result2 = mysql_query($sql2) or die(mysql_error());
$battle_get2 = mysql_fetch_array($result2);

echo '<img src="pokemon/'.$row['type'] .''.$battle_get2['pic'].'" border=0><p></p>
</a>' ; 
echo $row['pokemon'];
?>
<p></p>
<?php
echo "Level:";
echo $row ['level'];
?>
<p><form name="slot1" action="" method="post">
<div align="center">
<input type="submit" value="slot1" name="slot1">
</div>
</form> </p>
<?php
echo "Gender:";
echo $row['gender'];
echo "<br />";
}
?>
</center>
</p>
</div>
<div class="postfooter"></div>
</div>

我知道我不太擅长解释它,但非常感谢一些帮助:)

4

0 回答 0