Strange wierd problem
| From: | Tom Malone | Date: | Tue, 17 Jul 2001 04:36:31 +0000 |
| Subject: | Strange wierd problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-58181@lists.php.net to get a copy of this message | ||
I am using sessions to track visitors to my site, and one of the things I'd
like to do is add a time-stamp to each entry in my MySQL database. The
problem is that, for some reason, the time-stamp part only seems to work
part of the time. I know it can't be, but it almost seems arbitrary - i
haven't been able to determine a pattern. The code I'm using follows:
<?
session_start();
session_register("origin");
session_register("ip_address");
session_register("browser");
session_register("id");
$modules = "/****/modules";
$page = "$modules/index.inc";
include("$modules/db_info2.inc");
$id = session_id();
$ip_address = "$REMOTE_ADDR";
$browser = "$HTTP_USER_AGENT";
$sessn_root = "sessn-log";
$origin = "$HTTP_REFERER";
$now = date("D M j, H:i");
$sql = "INSERT INTO $table_name
(ndx, id, time, ip_address, browser, origin)
VALUES
(\"\", \"$id\", \"$now\", \"$ip_address\",
\"$browser\", \"$origin\")";
$result = mysql_query($sql, $connection) or die("Couldn't update session
logs. MySQL error: " . mysql_error());
include("$modules/template.html.php");
?>
Can anyone help?
Thanks in advance!
Tom