How do I update a MySQL table each time a page loads?
I am trying to debug some things going on within a particular page on my website.
To do this, i have set up a table in my database called '404'. I would like to write a few values to this table each time the page loads 开发者_StackOverflowbut i'm not having success.
Currently have the following php code at the top of this page:
<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/incl_func/env_constants.php"; ?>
<?php
//check 404 visits
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("Y-m-d H:i:s");
$agent = $_SERVER['HTTP_USER_AGENT'];
$refer = $_SERVER['HTTP_REFERER'];
$query = @mysql_query("INSERT INTO 404 (REF_URL, IP, AGENT, DATE) VALUES ('$refer', '$ip', '$agent', '$date')");
?>
I think this issue requires that i do this via ajax but I keep running into walls when trying to get this to work.
Thanks in advance for any help you can provide.
thanks everyone for the help. I was able to solve this by looking at the logs--was a better solution afterall. Turns out the issue with the 404 had to do with yahoo changing its geo locator service today. I wasn't aware they were discontinuing it
精彩评论