Hello,
I've been using PHP and SQL for about a year now but I cannot for the life of me work out why this doesn't work! I have other much more complex queries working on my site but I just can't get this to work!!!
<?php
require_once ('../mysql_connect.php'); // Connect to the database.
$result = mysql_query("SELECT * FROM `page_views` WHERE `id` = 1");
$myrow = mysql_query($result);
$hits = $myrow['hits'];
echo $hits;
?>
It's very simple: get a variable from a table and display it. The code displays no errors and if you set it so that $hits = 1 then it displays fine.
I've check all the obvious stuff, the table names etc, the mysql_connect.php and all are fine, this just doesn't work! Can anyone help me please?