Hi guys,
I dont really know where i am going wrong with this.
I am trying to collect user system stats to be stored in a db (php+myql).
I thought it would be simple enough but i keep running into problems. One part works then the other part stops working and vice versa again. It's been like that for 4 hours. It must be the way i am coding the script.
<?
// Include config file
include('common.php');
// Connect to database
$link = dbConnect();
// Get current date()
$sysDate = date("Y-m-d h:i:s");
// Get remote IP
$sysIP = gethostbyaddr($REMOTE_ADDR);
//check db for matching IP
$query1 = "SELECT * FROM idstats WHERE sysIP = '$sysIP'";
// if found add count
if(mysql_query($query1)) {
$query2 = "UPDATE idstats SET sysHits = sysHits+1, sysDate='$sysDate' WHERE sysIP='$sysIP'";
// Add new users stats to db
}else{
$query3 = "INSERT INTO idstats (sysHits, sysLang, sysOS, sysXY, sysAud, sysCam, sysIP, sysDate)VALUES( '1', '$sysLang', '$sysOS', '$sysXY', '$sysAud', '$sysCam', '$sysIP', '$sysDate')";
}
if(!mysql_query($query3)) {
fail("Error inserting new stats");
}
print "retval=1";
?>
Can anyone see anthing wrong?
Cheers
Paul