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 <[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

Reply via email to