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? Link to comment https://forums.phpfreaks.com/topic/28789-array-how-can-i-call/ Share on other sites More sharing options...
jpratt Posted November 28, 2006 Share Posted November 28, 2006 $priceList[2] Link to comment https://forums.phpfreaks.com/topic/28789-array-how-can-i-call/#findComment-131797 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.. Link to comment https://forums.phpfreaks.com/topic/28789-array-how-can-i-call/#findComment-131799 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 Link to comment https://forums.phpfreaks.com/topic/28789-array-how-can-i-call/#findComment-131812 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] Link to comment https://forums.phpfreaks.com/topic/28789-array-how-can-i-call/#findComment-131816 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 Link to comment https://forums.phpfreaks.com/topic/28789-array-how-can-i-call/#findComment-131824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.