Re: Why doesn't this work? HTTP_USER_AGENT

From: Date: Tue, 27 Nov 2001 07:11:42 +0000
Subject: Re: Why doesn't this work? HTTP_USER_AGENT
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-75752@lists.php.net to get a copy of this message
On Tue, 27 Nov 2001 17:43, Craig Vincent wrote: > <snip> > 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> > -------------------------------- > </snip> > > I copy & pasted your code onto a test HTML page and modified the mysql > commands to appropriately connect to my MySQL server. There was > absolutely no problem with this code at all. What version of PHP are > you using? Just about to do that but he saved me the effort. Any chance you created the script with DOS end of line characters?? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA If you're not confused, you're not paying attention.

« previous php.general (#75752) next »