Outputting results from Array? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Outputting results from Array? (/showthread.php?tid=37198) Pages:
1
2
|
Outputting results from Array? - El Forum - 01-01-2011 [eluser]invision[/eluser] Hmm, I'm still getting errors :'( My Error: Code: A PHP Error was encountered Severity: Notice View line 35: Code: <h2 class="sifr-title"><?php $entries['roomclass1']; ?></h2> Outputting results from Array? - El Forum - 01-01-2011 [eluser]Madmartigan1[/eluser] According to the data you posted earlier, it should be: Code: // In view file Should return "Premium Buchanan view offers both". Your array looks overly complicated but I assume you need it that way. Not to be an ass, but I would really suggest reading up on the basics of arrays if you are having this much trouble. It's worth spending the day on. Outputting results from Array? - El Forum - 01-01-2011 [eluser]invision[/eluser] I agree. I'm hoping to get this working then read the manual some more I couldn't get: Code: // In view file Code: A PHP Error was encountered Severity: Notice Outputting results from Array? - El Forum - 01-01-2011 [eluser]Madmartigan1[/eluser] I hope you mean the PHP manual and not the Codeigniter manual Do this and I try to help once more: In your view, do a print_r() on the variable. Come back and post the output. Outputting results from Array? - El Forum - 01-01-2011 [eluser]invision[/eluser] When I do print_r($entries) I get the following output: Code: Array ( [0] => Array ( [id] => 1 [atitle] => Buchanan View [metakeys] => [metadescr] => [aslug] => buchanan-view [status] => published [body] => This is the body of text here. This is the body of text here. This is the body of text here. This is the body of text here. [address] => 35 Calgary Street, G4 0XG [cost] => From: £94.00 p/w [addressdescr] => Buchanan view is located... [features] => Buchanan view offers a range... [roomclass1] => Premium Buchanan view offers both [roomclass2] => Classic Buchanan view offers a range of [roomclass3] => Basic There are no Basic rooms [atype] => 1 [country] => 0 [city] => 2 [category] => 1 [category_id] => 6 [pubdate] => 2010-12-23 [img] => buchanan-view-1-small.jpg [user_id] => 1 [city_title] => Turin [country_title] => ITA [category_title] => Student Accommodation ) ) Outputting results from Array? - El Forum - 01-01-2011 [eluser]invision[/eluser] Success! print_r($entries['0']['atitle']); Outputting results from Array? - El Forum - 01-01-2011 [eluser]invision[/eluser] Thanks for all your help and patience with this. Please enjoy the rest of your New Years Day now Outputting results from Array? - El Forum - 01-01-2011 [eluser]Madmartigan1[/eluser] OK. You have an array that contains another array. Try this in the view: Code: $entries[0]['roomclass1'] Outputting results from Array? - El Forum - 01-01-2011 [eluser]invision[/eluser] Yep, I basically have to make this value: ['0'] It's all sorted now. Thanks again for all your help |