Select before to see if exists:

if (db_num_rows() > 0) {
   // Update view where ip = visitor_ip
} else {
    // Normal insert


Julio Nobrega.

Um dia eu chego lá:

Ajudei? Salvei? Que tal um presentinho?

"Philip J. Newman" <[EMAIL PROTECTED]> wrote in message
I have a log of IP numbers that come to WEBSITE A

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

This has worked well, how ever when someone comes back with the same
"accessIP" then I would like then "accessVIEW" aadds a +1 to the value.

I would like help to create this ..

if (!$remote_addr) <- if the ip that they are using is the same as one in
the table then update the record and use the accessID for that record.

else if there isn't that $remote_addr in the table then it is added.

I have yet to start on the code, so would some direction.

Philip J. Newman
PhilipNZ :: Design Solutions
ICQ# 20482482
+64 25 6144012

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to