General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 28th, 2004, 10:38 AM
lamamike lamamike is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 lamamike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Listing dates as Sept 2-4,7-9 & Oct 4,5,6 etc.

Hello! I'm a newbie to dates in php and MySQL, and I have spent hours looking through forums for an answer to what I'm trying to do... I've found plenty on displaying single dates and comparing two dates, for example, but nothing on listing many dates...

Sorry if it's overkill, but I'll explain what I'm trying to do so the real coders (I'm a cut-and-paste developer right now with no real skills) can point me in the right direction properly...

I've build a form to input lots of dates into a MySQL table. Specifically, I've got two kinds of dates: multi-day events (where I have a startdate and enddate) and single-day events. Each entry (row) in the table has up to 10 such start- and end-dates and 30 single-day event dates. The dates are of the 'date' type, such that they are MM-DD-YYYY in the db.

As an example, consider I want to list three multi-day events and two single days after each of multi-day events. I don't want to have the month displayed again and again, just once for each set of dates...

I'm trying to display the multi-day events as: Sept 22-28 / Oct. 2-8 and 14-18
for example

And display the single-day events as: Sept. 29 / Oct. 1,9,10,19 and 20
for example

Any help you can give would be very appreciated!

Reply With Quote
  #2  
Old March 28th, 2004, 03:56 PM
tobycloud tobycloud is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Near Albany NY
Posts: 27 tobycloud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to tobycloud Send a message via AIM to tobycloud
Welll without thinking about the problem too much, there's one obvious tip I can give you...

Break it down. Don't try to put too much info into 1 row. After all, you can add as many rows/fields as you need. For Instance:

Say you had three events that occured on several different dates.


Event 1 - September 1-3; October 1-3; November 1-3
Event 2 - January 1
Event 3 - February 14-15; July 23


Create different rows for each month/event:


Row 1 - event=event_1, month=september, dates=1.2.3
Row 2 - event=event_1, month=october, dates=1.2.3
Row 3 - event=event_1, month=november, dates=1.2.3
Row 4 - event=event_2, month=january, dates=1
Row 5 - event=event_3, month=february, dates=14.15
Row 6 - event=event_3, month=july, dates=23


I know this isn't code you can copy/paste, but then again I'm not charging you either. This is just a helpful hint.

It will be easier to code the above scenario then it would be to write a function to determine different months, different dates, consequtive dates, non-consequtive dates, single dates, multiple dates. Especially since you're trying to store all of the above in one row. Breaking it down will make it easier to read and easier to code.

Reply With Quote
  #3  
Old April 8th, 2004, 10:11 AM
lamamike lamamike is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 lamamike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dates in php

sorry, but that's theoretically helpful, but otherwise not. I need some code. I can't seem to make anything I find work for me. And reading the PHP manual or MySQL is worse than Greek. Can someone point me to a good resource on PHP dates? If I find any, I'll come back and post them here, but so far nothing I've found is well-documented enough to make work. Thanks.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Listing dates as Sept 2-4,7-9 & Oct 4,5,6 etc.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT