jwk811 Posted November 28, 2006 Share Posted November 28, 2006 selling:price item12 blah56 blah272 blah3[code]while ($price = mysql_fetch_array($result)) { $priceList[] = $price;}echo $priceList[0][0]; // echos 12echo $priceList[0]['price']; // still echos 12, since you used fetch_arrayecho $priceList[0][1]; // echos blahecho $priceList[0]['item']; // still echos blah, since you used fetch_arrayecho $priceList[1][0]; // echos 56echo $priceList[1]['price']; // still echos 56, since you used fetch_arrayecho $priceList[1][1]; // echos blah2echo $priceList[1]['item']; // still echos blah2, since you used fetch_array[/code]how can i call blah 3? Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 28, 2006 Share Posted November 28, 2006 $priceList[2] Quote Link to comment Share on other sites More sharing options...
Jocka Posted November 28, 2006 Share Posted November 28, 2006 a new topic wasn't needed.. your code isn't needed there. This would do it:<?phpwhile($pricelist = mysql_fetch_array($result)){ echo $pricelist['price']; // PRICE echo $pricelist['item']; // ITEM}?>that does it right there.. Quote Link to comment Share on other sites More sharing options...
jwk811 Posted November 28, 2006 Author Share Posted November 28, 2006 $priceList[2]; is only showing up as 'Array'and $priceList['price']; isnt showing anything at all Quote Link to comment Share on other sites More sharing options...
Jocka Posted November 28, 2006 Share Posted November 28, 2006 ur fields are "price" and "item" right?The other way, the proper way to call it SHOULD be (assuming u have a blah3 in the database)$priceList[2][0] Quote Link to comment Share on other sites More sharing options...
jwk811 Posted November 28, 2006 Author Share Posted November 28, 2006 ok i got the hang of it now, thanks you guys 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.