Jump to content

Only displaying one row from Table... should be more


techiefreak05

Recommended Posts

I'm creating a trading system for my friends pet site, and its sll going well, until you view the offers on a trade, even when there are more offers made, it only shows the latest one...heres the code

 

<?php
$query1 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid]") or die(mysql_error());

while ($array1 = mysql_fetch_array($query1)){
$u__id = $array1[user_id];





$query3 = mysql_query("SELECT * FROM members2 WHERE id = $u__id") or die(mysql_error());

while ($array3 = mysql_fetch_array($query3)){
$offerer_Name =  $array3[username];
}





}

$query2 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid] AND user_id = $u__id") or die(mysql_error());

while ($array2 = mysql_fetch_array($query2)){
$item__id =  $array2[item_id];
}
?>




<h4>Offer made By: <?php echo $offerer_Name; ?></h4>
<img src=<?php echo $base_url; ?>/images/user_images/opg_1/items/item_<?php echo $item__id;?>.gif>

Try this (I moved the "}" down to the bottom, no other changes):

 

<?php

$query1 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid]") or die(mysql_error());

 

while ($array1 = mysql_fetch_array($query1)){

  $u__id = $array1[user_id];

 

  $query3 = mysql_query("SELECT * FROM members2 WHERE id = $u__id") or die(mysql_error());

 

  while ($array3 = mysql_fetch_array($query3)){

    $offerer_Name =  $array3[username];

  }

 

 

  $query2 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid] AND user_id = $u__id") or die(mysql_error());

 

  while ($array2 = mysql_fetch_array($query2)){

    $item__id =  $array2[item_id];

  }

?>

 

<h4>Offer made By: <?php echo $offerer_Name; ?></h4>

<img src=<?php echo $base_url; ?>/images/user_images/opg_1/items/item_<?php echo $item__id;?>.gif>

 

<?php

}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.