Welcome Guest, Not a member yet? Register   Sign In
Connecting two tables
#2

(This post was last modified: 08-17-2016, 06:20 PM by Joel Catantan. Edit Reason: correcting if condition )

I assume that the function in your post is withing your Model - I suggest that you must put a formatting of record within the controller.

public function jobsheets()
{
$data = array();
$result = $this->your_model->get_jobsheets();
$record_set_count = 0;

foreach($result as $index => $row)
{
// this will check if the next record of foreach (specifically in id) is the same
if(@$result[$index+1]->id == $row->id)
{
$data[$record_set_count]->task .= '<br>'. $row->task;
}
else
{
$data[] = $row;
$record_set_count++;
}
}

return $data;
}


Cheers! :)
[Just a programmer] Cool [/Just a programmer]
Reply


Messages In This Thread
Connecting two tables - by greenarrow - 08-16-2016, 01:35 PM
RE: Connecting two tables - by Joel Catantan - 08-16-2016, 06:39 PM
RE: Connecting two tables - by greenarrow - 08-16-2016, 09:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB