Page 1 of 1

inserting IP ADD into Mysql

Posted: Sat Oct 23, 2004 9:32 am
by sakaveli
hi ppl,

im trying to log IP addresses soon as sum1 logs onto my site, and store them into a DB, but im not sure what the query would look like?

i think that $_SERVER["REMOTE_ADDR"] holds the ip add, is that right? what would the insert statement look like for this?

Posted: Sat Oct 23, 2004 10:57 am
by John Cartwright
to simple add an ip to the database it would look something like

Code: Select all

$sql = "INS-ERT INTO `ips` SET `ip` = '".$_SERVER['REMOTE_ADDR']."'";


notice that INS-ERT should be INSERT, some problems with the server wont allow me to type it properly

Posted: Sat Oct 23, 2004 12:16 pm
by cto1mac
I tried to post that reply like 6 times, but, it kept erroring out. Is the insert the problem?

Posted: Sat Oct 23, 2004 12:27 pm
by John Cartwright
cto1mac wrote:I tried to post that reply like 6 times, but, it kept erroring out. Is the insert the problem?
I tried finding the thread, but feyd narrowed the problem down to a few words that arn't being accepted.

edit: i found it

viewtopic.php?t=27017