techiefreak05 Posted June 13, 2007 Share Posted June 13, 2007 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 https://forums.phpfreaks.com/topic/55362-only-displaying-one-row-from-table-should-be-more/ Share on other sites More sharing options...
btherl Posted June 13, 2007 Share Posted June 13, 2007 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 https://forums.phpfreaks.com/topic/55362-only-displaying-one-row-from-table-should-be-more/#findComment-273621 Share on other sites More sharing options...
techiefreak05 Posted June 13, 2007 Author Share Posted June 13, 2007 hhmm, nope, no change. Link to comment https://forums.phpfreaks.com/topic/55362-only-displaying-one-row-from-table-should-be-more/#findComment-273623 Share on other sites More sharing options...
btherl Posted June 13, 2007 Share Posted June 13, 2007 Can you add this line? print "There were " . mysql_num_rows($query1) . " offers made<br>"; immediately after the first mysql_query() ? Link to comment https://forums.phpfreaks.com/topic/55362-only-displaying-one-row-from-table-should-be-more/#findComment-273628 Share on other sites More sharing options...
techiefreak05 Posted June 13, 2007 Author Share Posted June 13, 2007 it says 2 offers were made, and I knew that. :-) Link to comment https://forums.phpfreaks.com/topic/55362-only-displaying-one-row-from-table-should-be-more/#findComment-273631 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.