Andrew R Posted November 26, 2008 Share Posted November 26, 2008 Sorry for the obscure title. I've got a database that has a column name frequency. The format of the frequency column is MTWTFSS (Monday, Tuesday, Wednesday etc). What I want to do is to display results based on the current date. The hard bit is the database contains all different variations for example, MTWT---, --W---- etc. $date = date("d"); SELECT * FROM freq WHERE frequency = '$date' Obviously the above won't work because of the format of the frequency column. Any help or advice on this would be much appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/134422-solved-date-and-frequency/ Share on other sites More sharing options...
niwa3836 Posted November 26, 2008 Share Posted November 26, 2008 Its a little late for me thinking I understand the whole question, however I think what you want to look at is LIKE, i.e. SELECT * FROM freq WHERE frequency LIKE '_".$date."__' _ is a single char, % is multiple chars date('d') doesnt look like the right thing anyway? you might want to format with date('D')? Link to comment https://forums.phpfreaks.com/topic/134422-solved-date-and-frequency/#findComment-699823 Share on other sites More sharing options...
Andrew R Posted November 26, 2008 Author Share Posted November 26, 2008 Thanks a million Link to comment https://forums.phpfreaks.com/topic/134422-solved-date-and-frequency/#findComment-699869 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.