php - Addition from MySQL query -
i trying add together this:
if (question_counter==10){ $query3 = "select answer_points participation_id=".$participation_id; $dbc->query($query3) } this supposed answer_points participation_id = "something". happens when receive in php function question_counter has reached 10
i want perform add-on between results receive in query above can find out total score , store variable.
how go doing efficiently?
i thought writing queries each reply participation_id , question_counter write query, store each row result in separate variable , add together together. think overkill , dumb since have write 10 queries each row's result.
anyway table
you can utilize mysql's sum function.
select sum(columnname) totalscore tablename id = 34; php mysql sql
No comments:
Post a Comment