I'm making a simple IP logger. I've tested the script, but the database doesn't seem to filling up. It could be a problem with the database format etc, details below. Otherwise, I must have made an newbie oversight in the PHP. Some fresh eyes would be greatly appreciated!
id: INT(10), unsigned, NN, primary key, auto_inc
page: VARCHAR(255), NN
logdate: VARCHAR(100), NN
ip: VARCHAR(100), NN
agent: MEDIUMTEXT, NN
<?php
include 'ip_finder.php'; // IP finder script, returns the variable $IP
include 'config.php'; // Database details
$tbl_name="table";
$ref = $_SERVER['REQUEST_URI'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$date = date("F j, Y, g:i a");
// echo $ref." ".$date." ".$IP." ".$agent;
$logger = "INSERT into doorbell ('page', 'logdate', 'ip', 'agent') VALUES ('$ref', '$date', '$IP', '$agent')";
if (!$logger){
die('Could not connect: ' . mysql_error());
} else {
echo "1 record added";
}
mysql_close();
?>