Marcel1993 Posted December 22, 2010 Share Posted December 22, 2010 Hey, I've got a query in which a variable is interpreted as a column and I don't why this is caused. $upgrade_time_sql = "SELECT * FROM todo_upgrades WHERE profile_id = ".$profile_id." AND level = ".$profile_data['level2_'.$show.'']." AND type = ".$show.""; $upgrade_time_res = mysql_query($upgrade_time_sql) or die (mysql_error()); $show is filled with the content "storage" The mysql_error is "Unknown column 'storage' in 'where clause'" Thanks for helping. Link to comment https://forums.phpfreaks.com/topic/222432-unknown-column/ Share on other sites More sharing options...
BlueSkyIS Posted December 22, 2010 Share Posted December 22, 2010 echo the SQL to see what it looks like. $upgrade_time_res = mysql_query($upgrade_time_sql) or die (mysql_error() . " IN $upgrade_time_sql"); Link to comment https://forums.phpfreaks.com/topic/222432-unknown-column/#findComment-1150531 Share on other sites More sharing options...
PFMaBiSmAd Posted December 22, 2010 Share Posted December 22, 2010 String data needs to be enclosed in single-quotes to make it string data, otherwise it is treated as an identifier (database, table, or column name.) Link to comment https://forums.phpfreaks.com/topic/222432-unknown-column/#findComment-1150532 Share on other sites More sharing options...
Marcel1993 Posted December 23, 2010 Author Share Posted December 23, 2010 Hey, thats was it :-) Thank you very much! :-) Link to comment https://forums.phpfreaks.com/topic/222432-unknown-column/#findComment-1150567 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.