mySql updating numbers

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi, sorry to double post. I also need some direction on how to update
mysql correctly when someone clicks a link it adds 1 to the database,
if someone clicks again it ads 1 which = 2 hits. What's the proper way
of doing this. Thanks again! - Mikey P.

Re: mySql updating numbers

If I understand your question, you're looking for something like this:

UPDATE `my_table` SET hits = hits + 1 WHERE record_id = '$id'

Obviously you'll need to change the variable names to match your table, but  
the point is you can use a column's current value in an update.

- Kevin

Quoted text here. Click to load it

Site Timeline