almightyegg Posted June 1, 2008 Share Posted June 1, 2008 I've done 3 whiles that while the same content but pick out different parts but only the first one is working... $select = mysql_query("SELECT * FROM itemsowned WHERE userid = '{$mem['id']}'"); $howmany = mysql_num_rows($select); if($howmany == 0){ echo "You have no items.<br>"; }else{ echo "Alchemy<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details[section] == 1){ if($details[sell] == No){ echo "$details[name] ($amount)<br>"; }else{ echo "<a href='market/market.php?code=$item[code]&sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; } } } echo "Materials<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details[section] == 2){ if($details[sell] == No){ echo "$details[name] ($amount)<br>"; }else{ echo "<a href='market/market.php?code=$item[code]&sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; } } } echo "Pit Items<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details[section] == 3){ if($details[sell] == No){ echo "$details[name] ($amount)<br>"; }else{ echo "<a href='market/market.php?code=$item[code]&sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; } } } } It echos out the right stuff rom first while then the other 2 don't send anything out[/code][/code][/code] Quote Link to comment Share on other sites More sharing options...
whizard Posted June 1, 2008 Share Posted June 1, 2008 if($details['sell'] == No) You need to put No inside double quotes Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 1, 2008 Author Share Posted June 1, 2008 That bit works in the first one though... Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted June 1, 2008 Share Posted June 1, 2008 you should have ALL strings quoted. not only 'No' in your if's but also your array indexes, $details['section'], etc. No != 'No' Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 1, 2008 Author Share Posted June 1, 2008 I changed that and it comes up with: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/lordofth/public_html/house.php on line 252 line 252: echo "<a href='market/market.php?code=$item &sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; I tried changing that to this: echo "<a href=\"market/market.php?code=$item['code']&sort=$mem['sortmarket']\">$details['name']</a> ($amount)<br>"; But no joy Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted June 1, 2008 Share Posted June 1, 2008 echo "<a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 1, 2008 Author Share Posted June 1, 2008 Still shows the error. But I really don't think it's an error with that anyway because the first one works fine... Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 1, 2008 Author Share Posted June 1, 2008 I don't know what I changed but the error has now gone. Still showing wrong info... $select = mysql_query("SELECT * FROM itemsowned WHERE userid = '{$mem['id']}'"); $howmany = mysql_num_rows($select); if($howmany == 0){ echo "You have no items.<br>"; }else{ echo "Alchemy<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details['section'] == '1'){ if($details['sell'] == 'No'){ echo " $details[name] ($amount)<br>"; }else{ echo " <a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; } } } echo "Materials<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details['section'] == '2'){ if($details['sell'] == 'No'){ echo " $details[name] ($amount)<br>"; }else{ echo " <a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; } } } echo "Pit Items<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details['section'] == '3'){ if($details['sell'] == 'No'){ echo " $details[name] ($amount)<br>"; }else{ echo " <a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; } } } } This echos: Inventory Alchemy Blah (1) Blah (87) Blah(1,000) Blah (10) Blah (119) Blah (2) Materials Pit Items And there are definitely things that sould show up in materials and pit items.... Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 1, 2008 Share Posted June 1, 2008 you should have ALL strings quoted. not only 'No' in your if's but also your array indexes, $details['section'], etc. No != 'No' I changed that .... Not if what you just posted is your current code. Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 1, 2008 Author Share Posted June 1, 2008 What have I missed then? Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 2, 2008 Author Share Posted June 2, 2008 I might have miss understood what BlueSkyIS said then... you should have ALL strings quoted. not only 'No' in your if's but also your array indexes, $details['section'], etc. No != 'No' I changed that .... Not if what you just posted is your current code. What havn't I done? Or what have I done wrong? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.