JChilds Posted August 30, 2010 Share Posted August 30, 2010 mysql_query('SELECT * FROM `tendered` WHERE DATE(`timestamp`) LIKE $sterm') or die(mysql_error()); Where $sterm = 2010-08-28 and `timestamp` are in format 2010-07-26 17:30:29 I get error "Unknown column '$sterm' in 'where clause'" I have no idea what could be wrong Quote Link to comment https://forums.phpfreaks.com/topic/212039-select-where-datetimestamp-like-sterm-problems/ Share on other sites More sharing options...
fenway Posted August 30, 2010 Share Posted August 30, 2010 What's wrong is that you're unfamiliar with how variable interpolation works. You need to be inside double quotes -- but, of course, you may be opening yourself to SQL injection, depending on where $sterm comes from. Quote Link to comment https://forums.phpfreaks.com/topic/212039-select-where-datetimestamp-like-sterm-problems/#findComment-1105228 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.