I have the following code
<?php
include ("db.php");
$query = mysql_query("SELECT * FROM `uniquehits` WHERE `ip` = '.$_SERVER['REMOTE_ADDR'].'");
if( !mysql_fetch_array( $query ) ) {
mysql_query( "INSERT INTO `uniquehits` VALUES( null, '".$_SERVER['REMOTE_ADDR']."' )" );
};
$result = ("SELECT `id` FROM `uniquehits` WHERE 1 ORDER BY `id` DESC LIMIT 1");
$query = mysql_fetch_array( mysql_query( $query, MYSQL_ASSOC ) ) ;
$query = $query['id'];
echo "We have received $query total hits since 3-7-2005."; ?>
And when I run it i get the following error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vhosts/scn.xoopiter.com/member/admin/stats.php on line 6
I got that code from a site. I cannot find it anymore. So I am wondering what I need to fix.