RE: [PHP] trouble passing variables through a URL
| From: | James Hallam | Date: | Mon, 04 Feb 2002 20:52:01 +0000 |
| Subject: | RE: [PHP] trouble passing variables through a URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83451@lists.php.net to get a copy of this message | ||
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:torben@pinc.com]On Behalf Of Lars
Torben Wilson
Sent: Monday, February 04, 2002 1:36 PM
To: James Hallam
Cc: php-general@lists.php.net
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_na&sec=news&subsec=media&name=infowee
> k1">Media 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 <torben@php.net>
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