I have one problem while retrieveing value from mysql using codeigniter.
I have one table name task and in that there is one field of assigneduserid.
Table - Task:
id | title | assigneduserid
-------------------------------------
1 | Workspace | 23,21
Table - User
id | title
-----------------
23 | Ashish
21 | Ritesh
In assigneduserid field there are two values in that field that is 23,21.
I want to print both usertitle like this : Ashish,Ritesh from usertable using that assigneduserid.
And also i want to set that value in ascending order which are in assigneduseid
I am trying to print that record on page using echo like following
Following is Code Where i am printing:
<?php echo $task_row->usertitle;?>
Above code is printing only Ashish.
but i would like to print Ashish,Ritesh
following is my model.
function getTask($id, $is_master_admin)
{
$this->db->select('workspace.title as workspacetitle, user.title as usertitle,task.*');
$this->db->join(WORKSPACE, WORKSPACE . '.id = ' . TASK . '.workspaceid', 'inner');
$this->db->join(USER, USER . '.id = ' . TASK . '.assigneduserid', 'inner');
$this->db->from(TASK);
if (!$is_master_admin) {
$this->db->where(USER . '.id', $id);
}
$this->db->where(TASK . '.tasktypeid', '1');
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
} else {
return false;
}
}
Thank you in advanced