insert this code for table you need 15 characters xxx.xxx.xxx.xxx
CREATE TABLE `my_table` (
`ip` VARCHAR( 15 ) NOT NULL
) ENGINE = innodb;
<?php
$cxn = mysqli_connect("Host", "User", "Pass", "DB");
$ip = getenv('REMOTE_ADDR');
$query = "INSERT INTO `my_table` (ip)
VALUES ('$ip')";
$result = mysqli_query($cxn, $query);
?>
You should have you connection made, i used mysqli you can edit to mysql.
Hope this helped. 🙂