Steve Angelis Posted June 16, 2008 Share Posted June 16, 2008 $ribbon_select = 'select * from phpbb_medal_user where user_id=$user_id_user'; $ribbon_result = mysql_query($ribbon_select) or die("$ribbon_select does not make any sence;<br>" . mysql_error()); $x = 0; while ($list = mysql_fetch_assoc($ribbon_result)) { $x++; echo $list['medal_id']; echo (($x % 9) == 0) ? "<br />" : " "; } That is my code. $user_id_user is a field that gets an id number of a user to match up all the data in a db to a specific user. The code works perfectly when you remove this part: where user_id=$user_id_user Once you insert it you get this error: select * from phpbb_medal_user where user_id=$user_id_user does not make any sence; Unknown column '$user_id_user' in 'where clause' Any ideas as to where I went wrong> Link to comment https://forums.phpfreaks.com/topic/110450-solved-odd-query-error/ Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 variables aren't evaluated inside single quotes...use double: $ribbon_select = "select * from phpbb_medal_user where user_id=$user_id_user"; Link to comment https://forums.phpfreaks.com/topic/110450-solved-odd-query-error/#findComment-566670 Share on other sites More sharing options...
Steve Angelis Posted June 16, 2008 Author Share Posted June 16, 2008 Now I feel like an idiot thanks. Link to comment https://forums.phpfreaks.com/topic/110450-solved-odd-query-error/#findComment-566672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.