Why doesn't this work? HTTP_USER_AGENT
| From: | chip | Date: | Tue, 27 Nov 2001 06:55:40 +0000 |
| Subject: | Why doesn't this work? HTTP_USER_AGENT | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75750@lists.php.net to get a copy of this message | ||
I have this small test page, below, which returns an error -
Parse error: parse error in /usr/local/apache/htdocs/test.php on line 4
on the $browser line, if I comment it out, it returns an error on the $ip
line, etc. I can leave all the php lines out, add an echo statement
<? echo $HTTP_USER_AGENT ?>
in the body to get the http_user_agent and it displays the user agent just
fine. What have I done wrong in such a simple bit of code?
-------------------------
<html><head><title></title></head>
<body>
<?
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR ;
$db = mysql_connect ( "localhost" , "username" , "password" );
mysql_select_db ( "database" , $db );
$sql = "INSERT INTO table_name(ip,browser,received)
VALUES('$ip','$browser',now())" ;
$results = mysql_query ( $sql);
?>
<h1>Howdy</h1>
</body></html>
--------------------------------
TIA,
Chip