-1

I have a button on a page that I would like use to increase the value of a column in a particular row of my database by 1. I have an idea of how I will parse the info except not entirely 100% on the sql e within my 'bridging' php file.
I'm thinking it will be an update statement but I'm not sure whether I can use i++ or something similar to increase the values by one.

$result = mysql_query("UPDATE markers SET verification = "???" WHERE name="somename")

The system I'm trying to build is a bit of an upvote/downvote system which the current 'numbervalue' is stored in the db, for use elsewhere within the page.
How can I do this? Cheers

user3663720
  • 305
  • 2
  • 12

1 Answers1

1

Yes you could increment them by one using your query with this:

$result = mysql_query("UPDATE markers SET verification = verification + 1 WHERE name='somename'");

Sidenote: And if possible, use a newer API which is mysqli or PDO instead.

Kevin
  • 41,694
  • 12
  • 53
  • 70
  • is there any reason why it would be automatically clearing the rest of that row besides the values after the WHERE clause, even though I am only 'reseting' the verification column? – user3663720 Oct 18 '14 at 21:30
  • All good, was something else somewhere else causing it. – user3663720 Oct 18 '14 at 21:39