Jump to content

Very weird Output... What's wrong?


Pi_Mastuh

Recommended Posts

The page I'm making displays each of the user's pets and some of the data. The Item that's equipped is stored in a different table so I copied the code exactly except changed the table stuff. However it's returning that 2 pets have an item equipped, which is correct. Except it's the wrong two pets, and it's not showing the third pet at all. It should be 1 with no item, 2 and 3 with items but it's returning 1 and 2 with items and not #3 at all. Here's my code.

[code]<?

//Databasing Stuff
include ("config.php");
session_start();
$session = session_id();

$db_name = "db175253437";

$conn = mysql_connect("db491.perfora.net", "****" ,"****", true) or die("Couldn't connect");

mysql_select_db($db_name, $conn) or die("Couldn't select Database1.");



//End Databasing Stuff

?>
<p align=center><? echo "Which pet would you like to send into batte:";?><br><br><a href='../forest.php'>Back to the Kriegit Forest</a><br><br><table width="480" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4">&nbsp;</td>
        </tr>
        <tr bgcolor="ebebeb">
          <td width="120"><div align="center"><b><font size="2" face="Arial, Helvetica, sans-serif">Picture</font></b></div></td>
          <td width="120" bgcolor="ebebeb" valign="top">
            <div align="center"><font size="2"><b><font face="Arial, Helvetica, sans-serif">Name</font></b></font></div></td>
          <td width="120">
            <div align="center"><font size="2"><b><font face="Arial, Helvetica, sans-serif">Species</font></b></font></div></td>
          <td width="120">
            <div align="center"><font size="2"><b><font face="Arial, Helvetica, sans-serif">Equipment</font></b></font></div></td>
        </tr>
      </table>
      <?
 
   $SQL = "SELECT * FROM chibifriendspets WHERE monopetID = '".$_POST['monopetID']."'";

$result1 = mysql_query($SQL, $connection) or die("Error: ".mysql_error()."");

$query_data = mysql_fetch_array($result1);

$query = "SELECT * FROM chibifriendspets WHERE userID = '$preuserID'";

$result4 = mysql_query($query, $connection);

$numberPETS = mysql_num_rows($result4);

$query_data = mysql_fetch_array($result4);

$monopetID = $query_data['monopetID'];
$monopetName = $query_data['monopetName'];

$monopetSpecies = $query_data['monopetSpecies'];

$monopetDOB = $query_data['monopetDOB'];



$SQL = "SELECT * FROM Dualequip WHERE petID = '".$_POST['monopetID']."'";

$result2 = mysql_query($SQL, $connection) or die("Error2: ".mysql_error()."");

$query_data = mysql_fetch_array($result2);

$query = "SELECT * FROM Dualequip WHERE preuserID = '$preuserID'";

$result5 = mysql_query($query, $connection);

$numberPETS = mysql_num_rows($result5);

$query_data = mysql_fetch_array($result5);

$itemName = $query_data['itemName'];

$itemID = $query_data['itemID'];

$i = 0;



if ($numberPETS < 1)
{

print "<CENTER>You don't have any petz!</CENTER>";

}

else {

while ($numberPETS > $i) {

//$monopetImage1 = mysql_result($result2,$i,"monopetImage1");

$monopetName = mysql_result($result4,$i,"monopetName");

$monopetSpecies = mysql_result($result4,$i,"monopetSpecies");

$monopetDOB = mysql_result($result4,$i,"monopetDOB");

$monopetID = mysql_result($result4,$i, "monopetID");





print "

<table width=480 border=0 cellspacing=0 cellpadding=0><tr><td width=180><form method=POST action=petDetails2.php>

<input type=hidden name=monopetID value=$monopetID>

<input type=image src=$monopetSpecies.jpg></FORM></td>

<td width=120 valign=middle><div align=center><font face=Arial, Helvetica, sans-serif size=2>$monopetName</font></div></td>

<td width=120 valign=middle><div align=center>$monopetSpecies</div></td>

<td width=120 valign=middle><div align=center>$itemName</div><td></td></td>

</tr></table>";



$i++;

}

}





///////







?>
[/code]

Thanks! :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.