facarroll Posted October 24, 2010 Share Posted October 24, 2010 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"); ?> Quote Link to comment Share on other sites More sharing options...
facarroll Posted October 24, 2010 Author Share Posted October 24, 2010 Fixed it myself. <?php $query1 = mysql_query("SELECT * FROM topics WHERE managerId=".$managerId." AND ".$egroup."= 1 ORDER BY title ASC"); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.