Jump to content

[SOLVED] Multiple dates in one SQL record - adding and sorting.


r00ttap

Recommended Posts

I just need some quick help on how to go about this. I've been working on a project that will post a message to a page by pulling the information from MySQL. This message will disappear on the end_date at the end_time. Simple enough right? Now it seems the users want some flexibility and instead of adding multiple messages manually one by one they want to be able to pick multiple dates from a calendar and the message will echo each of those dates letting people know that the message relates to those dates.

 

So the question is how do I go about adding multiple dates to ONE sql record? Right now I'm using a date array variable that holds all dates selected from this calendar in a space delimited YYYY-MM-DD format so once echoed it looks like this: 2009-06-01 2009-06-02 2009-06-03, etc...

 

Is there and easy method for handling multiple dates with SQL?

 

Thanks a lot.

Link to comment
Share on other sites

Thanks gassaz, now I'm getting somewhere.

 

How would you take the array of dates and add them to the "dates" table so that each date has it's own row and id?

 

Right now the variable for the dates would be: $dateArray = "2009-06-09 2009-06-10 2009-06-10";

Link to comment
Share on other sites

I think it would be done with a php script or some programming language. The mean idea is select row by row on the message table and using the string methods of the programming language to separate the dates and then insert into the new table.

 

 

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.