Re: [PHP] Why doesn't this work? HTTP_USER_AGENT
This is interesting. I did my testing in Opera 5.05 and it fails to display the page correctly. I then opened Netscape 6.2 and it works fine. Must be a problem with Opera. I also set Opera to identify itself as Netscape and it still failed to load the page. Thanks for the assistance. Chip On Monday 26 November 2001 11:11 pm, David Robley wrote: On Tue, 27 Nov 2001 17:43, Craig Vincent wrote: snip What have I done wrong in such a simple bit of code? - htmlheadtitle/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); ? h1Howdy/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?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Why doesn't this work? HTTP_USER_AGENT
$sql = INSERT INTO table_name(ip,browser,received) VALUES('.mysql_escape_string($ip).','.mysql_escape_string($browser).',now()) ; - Original Message - From: chip [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, November 27, 2001 4:39 PM Subject: Re: [PHP] Why doesn't this work? HTTP_USER_AGENT This is interesting. I did my testing in Opera 5.05 and it fails to display the page correctly. I then opened Netscape 6.2 and it works fine. Must be a problem with Opera. I also set Opera to identify itself as Netscape and it still failed to load the page. Thanks for the assistance. Chip On Monday 26 November 2001 11:11 pm, David Robley wrote: On Tue, 27 Nov 2001 17:43, Craig Vincent wrote: snip What have I done wrong in such a simple bit of code? - htmlheadtitle/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); ? h1Howdy/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?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Why doesn't this work? HTTP_USER_AGENT
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? - htmlheadtitle/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); ? h1Howdy/h1 /body/html TIA, Chip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Why doesn't this work? HTTP_USER_AGENT
snip What have I done wrong in such a simple bit of code? - htmlheadtitle/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); ? h1Howdy/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? Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Why doesn't this work? HTTP_USER_AGENT
On Tue, 27 Nov 2001 17:43, Craig Vincent wrote: snip What have I done wrong in such a simple bit of code? - htmlheadtitle/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); ? h1Howdy/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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]