papaface Posted January 9, 2007 Share Posted January 9, 2007 Hello,How would I go about incrementing a field in a table everytime i run a query on it?I think it is something like:[code]$update = "update videos set clicks = +1 where vidid='".$id."'";[/code]^^ but that doesnt work.regards Link to comment Share on other sites More sharing options...
ToonMariner Posted January 9, 2007 Share Posted January 9, 2007 $update = "update `videos` set `clicks` = `clicks` + 1 where `vidid`= '".$id."'"; Link to comment Share on other sites More sharing options...
papaface Posted January 9, 2007 Author Share Posted January 9, 2007 Thanks :) Link to comment Share on other sites More sharing options...
trq Posted January 9, 2007 Share Posted January 9, 2007 All those backticks are not at all required. Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 Nor is the concatenation of strings. $update = "UPDATE videos SET clicks = clicks + 1 WHERE vidid = '$id'";Sometimes people like to format things the way they like best :-P Link to comment Share on other sites More sharing options...
Recommended Posts