foreach ループを使用してデータベースから通知を受け取るコードイグナイターのモデルがあります。set_userdata を使用してセッションに値を渡したいのですが、残念ながらセッションに複数の値を渡すことができません。以下は私のモデルです。
function get_user_notifications($userID){
$this->db->select()->from('messages')->where('receiverID',$userID);
$query = $this->db->get();
if($query->num_rows()>0)
{
foreach($query->result() as $rows)
{
//add all data to session
$notification=$rows->notification;
$messageID=$rows->messageID;
// $rows->messageID =>,
$this->session->set_userdata('mynotifications',$notification);
}
}