How to maintain a Live balance without executing Again and Again?

Viewed 37

I have a error On Php I have 2 php Script installed One is written In Core php and another One Is on Code Ignitor, I stored a total User Balance on On A Variable $total On Codeignitor

I want To add Balance From both Script

I reload page Again It Gives executes like 5 +12 Let Consider I Placed That Code In home.php which is Under Controller/views/home.php The query is

 <?php $total=$corephpbalance+$codeignitorbalanc
#$total=5+7;
This->db->set('balance', $total);
This->db->Where ('user' $user);
This->db->Upadate('users);
  ?>

The Query Executes First Time Give 5+7=12 And executing Second Time Gives 5+12=17 And Goes On..... When I echo $total It Give 5+7 it Works Fine and the query Executed successfully and Balance added to Db

I want To Update Total Balance On mysql table on users Database Used By Code ignitor.

But The real Problem is When I reloads the Page The Query Executed again and again

How to Solve this I cant usee Insert on Existing Table Using WHERE Clause

please help me im a Beginner

0 Answers
Related