Jump to content


Photo

Very weird Output... What's wrong?


  • Please log in to reply
3 replies to this topic

#1 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 14 October 2006 - 11:01 PM

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.

<?

//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++;

}

}





///////







?>

Thanks! :)
Schroedinger's Cat walks into a bar.
And doesn't.

#2 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 15 October 2006 - 03:53 AM

The code is mainly the same as all the other codes i have that do mainly the same thing, only this one does the equipment display from another table and none of the others do.
Schroedinger's Cat walks into a bar.
And doesn't.

#3 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 15 October 2006 - 03:17 PM

Does anyone know what's wrong?
Schroedinger's Cat walks into a bar.
And doesn't.

#4 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 20 October 2006 - 02:05 PM

???
Schroedinger's Cat walks into a bar.
And doesn't.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users