RE: [PHP] trouble passing variables through a URL
(try again - Sorry for the double) my config: PHP 4.1.1/NT/iPlanet 6.1 This is the URL in its A tag: A HREF=test_mediacoverage.php?locale=en_nasec=newssubsec=medianame=infowee k1Media Coverage Test Page/A Those variables are supposed to be used to populate this SQL statement: $sql = SELECT comp, content FROM $locale WHERE sec = '$sec' AND subsec = '$subsec' AND name = '$name' ORDER BY comp ; If I hard code the variables in on the page it works, but if I leave it as is, I get this: You have an error in your SQL syntax near 'WHERE sec = '' AND subsec = '' AND name = '' ORDER BY comp ' at line 2 Any idea why these aren't being passed? James Hallam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] trouble passing variables through a URL
On Mon, 2002-02-04 at 11:49, James Hallam wrote: (try again - Sorry for the double) my config: PHP 4.1.1/NT/iPlanet 6.1 This is the URL in its A tag: A HREF=test_mediacoverage.php?locale=en_nasec=newssubsec=medianame=infowee k1Media Coverage Test Page/A Those variables are supposed to be used to populate this SQL statement: $sql = SELECT comp, content FROM $locale WHERE sec = '$sec' AND subsec = '$subsec' AND name = '$name' ORDER BY comp ; If I hard code the variables in on the page it works, but if I leave it as is, I get this: You have an error in your SQL syntax near 'WHERE sec = '' AND subsec = '' AND name = '' ORDER BY comp ' at line 2 Any idea why these aren't being passed? James Hallam Dollars to donuts you have register_globals turned off; that's the default in PHP 4.1.x+. It's safer not to use it. :) Try this: $sql = SELECT comp, content FROM $_REQUEST[locale] WHERE sec = '$_REQUEST[sec]' AND subsec = '$_REQUEST[subsec]' AND name = '$_REQUEST[name]' ORDER BY comp ; Hope this helps, Torben -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] trouble passing variables through a URL
That was *exactly* it.. I copied that code in and everything worked! Thanks so much - my head was getting sore from beating it on my desk! I still have much to get used to with 4.1.x .. James -Original Message- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]]On Behalf Of Lars Torben Wilson Sent: Monday, February 04, 2002 1:36 PM To: James Hallam Cc: [EMAIL PROTECTED] Subject: RE: [PHP] trouble passing variables through a URL On Mon, 2002-02-04 at 11:49, James Hallam wrote: (try again - Sorry for the double) my config: PHP 4.1.1/NT/iPlanet 6.1 This is the URL in its A tag: A HREF=test_mediacoverage.php?locale=en_nasec=newssubsec=medianame=infowee k1Media Coverage Test Page/A Those variables are supposed to be used to populate this SQL statement: $sql = SELECT comp, content FROM $locale WHERE sec = '$sec' AND subsec = '$subsec' AND name = '$name' ORDER BY comp ; If I hard code the variables in on the page it works, but if I leave it as is, I get this: You have an error in your SQL syntax near 'WHERE sec = '' AND subsec = '' AND name = '' ORDER BY comp ' at line 2 Any idea why these aren't being passed? James Hallam Dollars to donuts you have register_globals turned off; that's the default in PHP 4.1.x+. It's safer not to use it. :) Try this: $sql = SELECT comp, content FROM $_REQUEST[locale] WHERE sec = '$_REQUEST[sec]' AND subsec = '$_REQUEST[subsec]' AND name = '$_REQUEST[name]' ORDER BY comp ; Hope this helps, Torben -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php