In article <001001c1d070$76ef8dd0$0401a8c0@philip>, 
[EMAIL PROTECTED] says...
> 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);
>  }
> 
> ?>

Seems to me that you are treating accessIP as a string in one and an 
integer in the other query.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to