Can anyone tell me why this isn't working?  What its ment to do is add an IP number to 
the database. if the IP is all ready in the database then it would update a counter.


<?php

$proxy_ip=getenv('REMOTE_ADDR'); 
$proxy_dns=gethostbyaddr($proxy_ip);
$add_date=date ("d/F/Y  @ h:i:s A");

$sql = "SELECT accessIP FROM `access` ORDER BY `accessID` DESC";
$sql_result = mysql_query($sql, $connection) or die ("Could not get Query"); 

$row = mysql_fetch_array($sql_result);
$accessIP = $row["accessIP"]; 

if (mysql_num_rows($sql_result) < 0) {
    
 // Update view where ip = visitor_ip
 mysql_query("UPDATE access SET accessVIEW = accessVIEW+1 WHERE accessIP = $accessIP");
 
 } else {

     // Normal insert
  $sql = "INSERT INTO `access` (`accessID`, `accessIP`, `accessDNS`, `accessTIME`, 
`accessUPDATE`, `accessVIEW`) VALUES ('', '$proxy_ip', '$proxy_dns', '$add_date', 
NOW(NULL), '0')";
     $result = mysql_query($sql);
 }

?>

Philip J. Newman
PhilipNZ :: Design Solutions
http://www.philipnz.com/
[EMAIL PROTECTED]
ICQ# 20482482
+64 25 6144012

Reply via email to