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>

Link to comment
Share on other sites

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

}

?>

 

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.