![]() |
result() ? or row()? or what?! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: result() ? or row()? or what?! (/showthread.php?tid=31692) |
result() ? or row()? or what?! - El Forum - 06-28-2010 [eluser]Tom Taila[/eluser] hey guys, im havin a lil bit of a noob moment, so basically i made a lil mini friends system for a website, and i wanna echo out friend requests (if there are any) on a users profile page, now if i have two or more friend requests these requests will be shown with no problem as i know i can use return $query->result() to get a number of rows from my 'friends' table, but if theres only one single request it will not be shown, also i know i can use $query->row() but that would mean if there were more than one request than those wouldnt show, so what do i do? im using a foreach() statement to echo em out, ill show u my codes below: my user profilepage view file: Code: <?php my user controller function to load the users own page: Code: function own_page()//this function is for loading your own page and my model: Code: function get_friend_requests() thanks so much, cheers result() ? or row()? or what?! - El Forum - 06-28-2010 [eluser]InsiteFX[/eluser] Code: function get_friend_requests() Here is another way: Code: $data = array(); InsiteFX result() ? or row()? or what?! - El Forum - 06-30-2010 [eluser]Tom Taila[/eluser] wow, awesome, before i had to creat if statments depending on wether i had one result or many, was much longer than ur way, thanks so much ![]() |