php - Result row_array() Iterate and implode to set the value in insert query -
good day!
i have code:
$tokenize = explode(',', $secondaryrolecode); foreach($tokenize $delimited) { $delimited = trim($delimited); $query_secondaryrole = $this->db->query("select id role rolename '%".$delimited."%';"); $get_secondaryid = $query_secondaryrole->row_array(); $ids = ''; foreach($get_secondaryid $sec_id) { if($ids !="") { $ids .= ",".$sec_id['id']; } else { $ids = $sec_id['id']; } } echo $ids; $this->db->set('secondaryroleid', $ids); } but having problem result:
when var_dump $get_secondaryid has this:
array(1) { ["id"]=> string(1) "3" } array(1) { ["id"]=> string(1) "6" } in echoresult, output 36. wondering why doesn't output 3,6. , in set insert query, output 6. , don't why not result 36 in echo result? again need output this: 3, 6.
can me this?
Comments
Post a Comment