mitchnufc
mitchnufc

Reputation: 309

sql update query not running

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

Answers (2)

yehuda
yehuda

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

juergen d
juergen d

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

Related Questions