Need help for an rookie - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Need help for an rookie (/showthread.php?tid=63690) |
Need help for an rookie - Violette - 11-28-2015 Hello, Sorry for my English. With this function , I retrieves the number of identical record in the " from_user_id " the table "user- love" . num_rows() displays the number of recording I want to insert a new tabe "score" value " from_user_id " and the result given by " num_row " that two field " from_user_id " and " nb_kiff but I can not seem to find the right combination . Is a charming young man can help me to complete this function ? thank you in advance Here is my Model Code: function count_add_kiff($add_kiff) { Here is my Controleur Code: $add_kiff = $this->news_model->count_add_kiff($this->session->userdata("user_id")); RE: Need help for an rookie - Violette - 11-29-2015 LaPouleLustucru thank you very much , it's perfect! you allowed me to make good progress . I forgot to mention in my first post but I want to add a condition. I hope that if the value of $user_id exists in " from_user_id " , the value of $nb_kiff will be updated in "nb_kiff" , otherwise insert . I tried different methods but I can not write my code correctly . If I try : if $ user_id > 0 , it does not. Can you help me to complete my code please . Here's what I try to do : PHP Code: public function count_add_kiff($user_id) Thank you in advance Violette RE: Need help for an rookie - Violette - 11-30-2015 ok .... but now I have a white page. I think its just the " controllers " . Before I had this! PHP Code: $add_kiff = $this->news_model->count_add_kiff($this->session->userdata("user_id")); and my "View" , I have that! Quote: RE: Need help for an rookie - Violette - 11-30-2015 LaPouleLustucru you are fantastic ... I thank you all heart ... it is ! Perfect ! Thank you for your valuable help .... I close the subject. Thank you again ! and thanks to this Forum |