![]() |
Issue with data return - 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: Issue with data return (/showthread.php?tid=8841) |
Issue with data return - El Forum - 06-02-2008 [eluser]jbads[/eluser] Hi, I may sound stupid here, I probably am. I've been struggling for hour with a function that gets a list of a persons contacts based on their userid and I would like it to retrieve certain data for each contact on that list. This is my page view controller eg: Code: //Get members contacts And this is the function Code: protected function _get_member_contacts($id){ I've tried every combination of result_array() and row() and row_array() etc I can think of. Its driving me insane because I know it's going to be something small that requires doing. So If anyone can see what I'm trying to do here and can suggest a way of doing it, it would be greatly appreciated. Cheers. Jake Issue with data return - El Forum - 06-02-2008 [eluser]Rick Jolly[/eluser] Looks like you're overwriting your results. Replace this: Code: $data['contacts']['id'] = $res->id; With this: Code: $contact['id'] = $res->id; Issue with data return - El Forum - 06-02-2008 [eluser]jbads[/eluser] Thanks for the reply. I have tried you method and got further than I had before. My view is now displaying the records from the database after also listing characters from the field names and error messages like this Quote:A PHP Error was encounteredAlso error for line number 81 and 84 Code: <?php if(!empty($contacts)) Quote:Array ( [id] => 39 [username] => Tester 6 [name] => [email] => [email protected] [location] => Hastings [0] => Array ( [id] => 35 [username] => test2 [name] => [email] => [email protected] [location] => [0] => Array *RECURSION* ) [1] => Array ( [id] => 38 [username] => Test5 [name] => Fucker [email] => [email protected] [location] => Wellington City [0] => Array ( [id] => 35 [username] => test2 [name] => [email] => [email protected] [location] => [0] => Array *RECURSION* ) [1] => Array *RECURSION* ) [2] => Array *RECURSION* ) Any suggestions? |