Jump to content

[SOLVED] add 1-10 more to a mysql filed


The Little Guy

Recommended Posts

Is it possible to update a field by adding a number 1-10?

 

Example:

say the filed currently has a number of 1230, and I want to add 10 to that field, the new filed will now hold 1240

 

How can I do that without doing 2 queries?

 

Oh yeah, this would be using the UPDATE sql

Link to comment
https://forums.phpfreaks.com/topic/38721-solved-add-1-10-more-to-a-mysql-filed/
Share on other sites

That worked 90%, but then I modified it to work 100%.

 

I removed the single quotes, and the parenthesis and it worked then

$sql = mysql_query("UPDATE snippets SET voteTotal=voteTotal+$vote, votes=votes+1 WHERE id='$id'")or die(mysql_error());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.