Jump to content

[SOLVED] Date and Frequency


Andrew R

Recommended Posts

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

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')?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.