Jump to content

What is wrong with this SELECT statement?


facarroll

Recommended Posts

I have a Select statement that relies on two session variables to complete the statement. One variable, $egroup, supplies a column name. I cannot make the SELECT work. It works fine if I substitute the real name of one of the columns  such as "egroup1", or "egroup6", but that's what the variable $egroup is for. Can anyone tell me where I'm wrong?

 

I guess the answer is in the syntax, but I'm not very good at this and I've been on it for too long. Any help gratefully taken.

 

<?php                 
$query1 = mysql_query("SELECT * FROM topics WHERE managerId='".$managerId."' AND "$egroup"= 1 ORDER BY title ASC");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.