0

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();

?>
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
1
$logger = "INSERT into doorbell (page, logdate, ip, agent) VALUES ('$ref', '$date', '$IP', '$agent')";
0

hmmm. that seems to have done it... Although I swear I already tried without quotes...
some sort of devil magic going on..

Cheers mate!

0

Ok, great, are we solved?

If so, click the link below 'Thread Solved' or whatever it says. Cheers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.