steviez Posted March 4, 2007 Share Posted March 4, 2007 Hi, I am trying to get a table in my database to updae everytime the page loads, it will count how many times a video has been watched. I need to update 'no_of_times_viewd. How is this done? Thanks Link to comment https://forums.phpfreaks.com/topic/41075-solved-php-sql-help/ Share on other sites More sharing options...
fert Posted March 4, 2007 Share Posted March 4, 2007 UPDATE `table` SET field=value+1 WHERE field=value Link to comment https://forums.phpfreaks.com/topic/41075-solved-php-sql-help/#findComment-198910 Share on other sites More sharing options...
hukadeeze Posted March 4, 2007 Share Posted March 4, 2007 To use the update statement you must first select the old value, then increment it by 1. SELECT value $value + 1 UPDATE value Link to comment https://forums.phpfreaks.com/topic/41075-solved-php-sql-help/#findComment-198914 Share on other sites More sharing options...
steviez Posted March 4, 2007 Author Share Posted March 4, 2007 But how do i get this to happen everytime my page loads?? im new to php Link to comment https://forums.phpfreaks.com/topic/41075-solved-php-sql-help/#findComment-199076 Share on other sites More sharing options...
hukadeeze Posted March 4, 2007 Share Posted March 4, 2007 If you place it on the same page as the video it will happen automatically. So every time that page is loaded, the code will run. Link to comment https://forums.phpfreaks.com/topic/41075-solved-php-sql-help/#findComment-199188 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.