![]() |
Help for add values - 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: Help for add values (/showthread.php?tid=63807) |
Help for add values - Violette - 12-10-2015 Hello, I need help to help me correct my php function in codeigniter. I have a database; I want addi all values of " from_user_id ". I use this sql to get the desired result. Code: SELECT SUM(kiff_envoi+kiff_recu+visite_recu+profile_visite+da_recu+da_envoi+topic_poster+repon_topic+conv_envoi+conv_recu) AS total_stats FROM score WHERE from_user_id = ? I use this function. It allows me to check if " from_user_id " exists, if it exists, we calculate the total different tables and we update the result in " total_stats ". If " from_user_id " does not exist, create it. But my function does not return me the right result. I had to make a big mistake but I do not know where! Does someone could help me please. print_r($result); return 0 in database ! PHP Code: public function count_tout_stats($user_id) //total des stats RE: Help for add values - Violette - 12-11-2015 Thank you very much LaPouleLustucru it works perfectly. You were me of great help! kiss |