JSHINER Posted October 1, 2007 Share Posted October 1, 2007 How can I update the value of a table field each time a page is viewed? So if I set it to start at 0, when the page is called up it updates +1 to 1, then +1 to 2, etc. Link to comment https://forums.phpfreaks.com/topic/71357-solved-updating-a-field-every-time-a-page-is-viewed/ Share on other sites More sharing options...
php_dave Posted October 1, 2007 Share Posted October 1, 2007 Not sure I understand what you are asking for but the below Query will increment a field everytime it is called UPDATE tablename SET fieldname = fieldname + 1; That what you meant? Link to comment https://forums.phpfreaks.com/topic/71357-solved-updating-a-field-every-time-a-page-is-viewed/#findComment-359026 Share on other sites More sharing options...
JSHINER Posted October 1, 2007 Author Share Posted October 1, 2007 Yes exactly - now how can I get this to work? //$db->query("UPDATE tablename WHERE id = $id SET fieldname = fieldname + 1"); Link to comment https://forums.phpfreaks.com/topic/71357-solved-updating-a-field-every-time-a-page-is-viewed/#findComment-359034 Share on other sites More sharing options...
JSHINER Posted October 1, 2007 Author Share Posted October 1, 2007 Never-mind got it. Thanks! Link to comment https://forums.phpfreaks.com/topic/71357-solved-updating-a-field-every-time-a-page-is-viewed/#findComment-359036 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.