Hi
Try without quotes :
$table_name = $locale;
Your SQL is probably reading "SELECT comp, content FROM $locale instead of
en_na
Regards
Girish
----- Original Message -----
From: "James Hallam" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Saturday, February 02, 2002 12:42 AM
Subject: [PHP] stupid URL variable question
Can anyone explain why this URL and SQL statement won't work?
<A
HREF="test_mediacoverage.php?locale=en_na&sec=news&subsec=media&name=infowee
k1">Media Coverage Test Page</A>
--> And on test_mediacoverage.php ..
$table_name = "$locale";
// ..connection content..
$sql = "SELECT comp, content FROM $table_name
WHERE sec = '$sec' AND
subsec = '$subsec' AND
name = '$name'
ORDER BY comp
";
$result = @mysql_query($sql,$connection)
or die("Couldn't execute query.");
It's giving me the 'Couldn't execute query' result, but the SQL statement
does work with the values hard-coded in.. So it must be something about the
way the values are passed through the URL.
On a furthur note, is this a good idea? I'm using the URL to determine what
content goes into the the template.. I'm not using sessions or cookies (no
authentication needed..) so is there a better way to do this?
Thanks,
James
--
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]