Strange behavior of MySQL UPDATE query in PHP?
- by Prashant
When I am executing following query then its not updating views column by 1 instead sometimes its updating it by 2 or 3. Say currently views count is 24 then after executing this query it becomes 26 or sometimes its 27.
$views = $views + 1;
$_SQL = '';
$_SQL = 'UPDATE videos SET views = '.$views.' WHERE VideoId= "'.$videoid.'";';
@mysql_query($_SQL);
I am not getting why this is happening, am I missing something or the query is executing 2 times automatically? Please help me to figure out the issue.
Thanks