[PHP-DB] Storing IP into DB

2003-01-30 Thread web man

Hi,
I wondered if anyone could help me.
I would like to store the user IP only once
per multiple visits.
The code below store the user IP on every visit
which is not my intention.
Please I would like to have the IP stored at once upon
repetitive visits of the user.
Thank
Below is my code

?

$ip_address = getenv (REMOTE_ADDR); 
$the_date = date(Y-m-D);
$connect = mysql_connect(localhost, user, pass) or die(Cant Connect!);
mysql_select_db(ipvisits)or die(Cant Connect To Database);
mysql_query(INSERT into visitorsips (ip, date) VALUES ('$ip_address', '$the_date'));
mysql_close($connect);

?




-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP-DB] Storing IP into DB

2003-01-30 Thread web man

Hi,
I wondered if anyone could help me.
I would like to store the user IP only once
per multiple visits.
The code below store the user IP on every visit
which is not my intention.
Please I would like to have the IP stored at once upon
repetitive visits of the user.
Thank
Below is my code

?

$ip_address = getenv (REMOTE_ADDR); 
$the_date = date(Y-m-D);
$connect = mysql_connect(localhost, user, pass) or die(Cant Connect!);
mysql_select_db(ipvisits)or die(Cant Connect To Database);
mysql_query(INSERT into visitorsips (ip, date) VALUES ('$ip_address', '$the_date'));
mysql_close($connect);

?




-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


Re: [PHP-DB] Storing IP into DB

2003-01-30 Thread 1LT John W. Holmes
 I wondered if anyone could help me.
 I would like to store the user IP only once
 per multiple visits.
 The code below store the user IP on every visit
 which is not my intention.
 Please I would like to have the IP stored at once upon
 repetitive visits of the user.
 Thank
 Below is my code

 ?

 $ip_address = getenv (REMOTE_ADDR);
 $the_date = date(Y-m-D);
 $connect = mysql_connect(localhost, user, pass) or die(Cant
Connect!);
 mysql_select_db(ipvisits)or die(Cant Connect To Database);
 mysql_query(INSERT into visitorsips (ip, date) VALUES ('$ip_address',
'$the_date'));
 mysql_close($connect);

Make your 'ip' column UNIQUE in your table and ignore errors.

Or, set a flag in a session or cookie when you save the IP and if that flag
is present on other pages, then don't save the IP.

---John Holmes...


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




Re: [PHP-DB] Storing IP into DB

2003-01-30 Thread Chris Boget
 Make your 'ip' column UNIQUE in your table and ignore errors.
 Or, set a flag in a session or cookie when you save the IP and if that flag
 is present on other pages, then don't save the IP.

Or I believe you can use REPLACE INTO...

Chris


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




Re: [PHP-DB] Storing IP into DB

2003-01-30 Thread 1LT John W. Holmes
  Make your 'ip' column UNIQUE in your table and ignore errors.
  Or, set a flag in a session or cookie when you save the IP and if that
flag
  is present on other pages, then don't save the IP.

 Or I believe you can use REPLACE INTO...

True. I don't think all databases implement REPLACE, though... so it depends
on your config.

---John Holmes...


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