vForums Support > Programming & Coding :: Programming Discussion :: > Updating a row

Updating a row - Posted By Dylan (dylan) on 8th Feb 08 at 2:52am
Could I do this?
mysql_query("UPDATE users SET something+1 WHERE username='1'");

I'm trying to do something like that and it's not working.

Re: Updating a row - Posted By Ross (admin) on 8th Feb 08 at 11:35am
It'd be:

Code:
 
  1. mysql_query("UPDATE users SET something=something+'1' WHERE username='1'");
 

Re: Updating a row - Posted By Dylan (dylan) on 8th Feb 08 at 12:21pm
Thanks rosss

Re: Updating a row - Posted By Marc (cr0w) on 8th Feb 08 at 8:43pm
 
It'd be:

Code:
 
  1. mysql_query("UPDATE users SET something=something+'1' WHERE username='1'");
 


Actually, it should be:

Code:
 
  1. mysql_query("UPDATE users SET something=something+1 WHERE username='1'");
 


Numbers shouldn't be inside quotes. {Wink}

Re: Updating a row - Posted By Ross (admin) on 8th Feb 08 at 9:22pm
I've always used them in quotes and it works fine. In fact I think I had errors last time I tried with no quotes.

Re: Updating a row - Posted By Marc (cr0w) on 9th Feb 08 at 4:33am
 
I've always used them in quotes and it works fine. In fact I think I had errors last time I tried with no quotes.


That's odd. {Unsure} I'm sure that I saw on PHP's site that quotes take more time to process than without. {Unsure}

I shall search for it again and see what I find. {Smile}

Re: Updating a row - Posted By Ross (admin) on 9th Feb 08 at 10:23am
I'll have to try no quotes next time then and see if that helps {Smile}