RE: [PHP] stupid URL variable question

From: Date: Sat, 02 Feb 2002 01:02:28 +0000
Subject: RE: [PHP] stupid URL variable question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83221@lists.php.net to get a copy of this message
I think that was a necessary step, I had missed that one, but it unfortunately hasn't solved the problem. Once again the page works fine if I hard-code the values, but even if I replace en_na with $locale, it breaks.. James -----Original Message----- From: Girish Nath [mailto:girishn@btinternet.com] Sent: Friday, February 01, 2002 5:53 PM To: James Hallam; Php-General Subject: Re: [PHP] stupid URL variable question 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" <jhallam@dwl.net> To: "Php-General" <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#83221) next »