Hi

I'm not sure what's causing it then - you can get better error reporting
using by removing the @ sign and using mysql_error() like this :

$result = mysql_query($sql,$connection) or die(mysql_error());

Regards


Girish

----- Original Message -----
From: "James Hallam" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Saturday, February 02, 2002 1:02 AM
Subject: RE: [PHP] stupid URL variable question


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:[EMAIL PROTECTED]]
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" <[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]


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

Reply via email to