Reputation: 309
Hello I am trying to test the following mySql query within phpmyadmin before using it within a test enviorment page.
my result should update the donate_Total by adding a value of 2000 to the exsisting value held and storing the total in there where the first_Name and last_Name are matched. I have the user named in the sql code below but this won't run, any pointers?
UPDATE `donate` SET `donate_Total`= 'donate_Total' + 2000 WHERE first_Name = 'Test' AND last_Name ='One' ;
table name is donate and column name to update is donate_Total
Upvotes: 2
Views: 83
Reputation: 1282
change 'donate_total' to donate_total without the quotes. You are trying to add two intergers together, therefore you cannot put it as a string.
UPDATE `donate` SET `donate_Total`= donate_Total + 2000 WHERE first_Name = 'Test' AND last_Name ='One' ;
Upvotes: 1
Reputation: 204756
I guess you want to add 2000
to your donate_total
. If 2000
is not the name of a column then leave the []
and the '
UPDATE `donate`
SET donate_Total = donate_Total + 2000
WHERE first_Name = 'Test'
AND last_Name ='One' ;
Upvotes: 0