Count how many notification doesn't read by users |
Hello guys, cotinue my last question yesterdays !
here is my images design database, please click here as you can see this table store who user and announcement already read, this is my way how to ge which one announcement not read yet Code: public function notif() but not good cause i don't know how to get each data based on this $data=$rs->result_array(); i tried <?php echo $data->cu_anoun_id ?> always get errors Message: Trying to get property of non-object then i change to be echo $data['cu_anoun_id']; got errors like this Message: Undefined index: cu_anoun_id might be there is easy way to get how many announcement for each users which one already read or whihc one doesn't read, Note : All i want too is count how many announcement alreadty read , thanks
When you pass the array with result_array, it point the array as zero pointing.
When you print_r($data) you can see it in model. So to access some of value inside the $data you have to point zero as well Code: echo $data[0]['cu_anoun_id']; And this $data[0] is required. Quote:As well as this is only valid inside model an controller only. (02-02-2016, 12:45 PM)abdullacool04 Wrote: When you pass the array with result_array, it point the array as zero pointing. Hi thanks for answer this, but when i only code like this Code: echo $data[0]['cu_anoun_id']; Code: echo $data[0]['cu_anoun_id']; Means it repeatation, how can i code with clean code, thanks (02-02-2016, 06:49 PM)freddy Wrote:(02-02-2016, 12:45 PM)abdullacool04 Wrote: When you pass the array with result_array, it point the array as zero pointing. Well please check this out, is it spageti code or not ! Code: public function notif() i can get all data but think still spageti code |
Welcome Guest, Not a member yet? Register Sign In |