What's wrong with this php code?

Jona B

New member
im trying to write a code so whenever a page is loaded, the view counts add 1 to it.


<?

$id = $_GET['id'];

$views = mysql_query("SELECT views FROM movies WHERE id = $id ");
$views = mysql_fetch_array($views)[0];
$views++;
mysql_query("UPDATE movies SET views = $views WHERE id = $id ");

?>
tablename is movie, column is views, and views is default 0.
i don't think that's the problem... thanks though
 
Back
Top