More than likely, the query is failing because you've used a column name called "date" which is also a reserved word in MySQL (for the DATE() function). You'll need to enclose it in "back-quotes" so that MySQL knows it's an identifier and not a function name:
INSERT INTO visitor_log (ipaddress,`date`,time,kid,sid)......
(Note: it doesn't hurt to back-quote all table names and column names, just to be safe.)
A useful practice while creating your scripts is to always test mysql_query() calls for failures (and in this case also check to see if any rows were updated):
$result = mysql_query($query);
if(!$result)
{
user_error("Query failed: $query - " . mysql_error(), E_USER_WARNING);
}
elseif(mysql_affected_rows() == 0)
{
user_error("DB record not inserted: $query - " . mysql_error(), E_USER_WARNING);
}