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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.