Jump to content

[SOLVED] increment value in table?


Dragen

Recommended Posts

How do I increment an int variable by 1, in a table.

I'm currently using this code:

<?php
$clicks = $row['clicks']+1;
$result = mysql_query("UPDATE downloads SET clicks = '$clicks' WHERE down_id = '$id'") or die (mysql_error());
?>
which works, but it there a way of having clicks increment without having to use another variable?
such as:
[code]SET clicks = clicks++

I have tried the above, but it doesn't work..

 

I've tried searching for it and just found lots of sites about auto increment table types.. :-\

 

Thanks[/code]

Link to comment
https://forums.phpfreaks.com/topic/47870-solved-increment-value-in-table/
Share on other sites

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.