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"); ?> Link to comment https://forums.phpfreaks.com/topic/216683-what-is-wrong-with-this-select-statement/ 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"); ?> Link to comment https://forums.phpfreaks.com/topic/216683-what-is-wrong-with-this-select-statement/#findComment-1125788 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.