Jump to content

Recommended Posts

So I am creating an application that will take various inputs and add them to a timeline. So if i have an event and i mark it as Dec 28 2006, etc., it will show up when i run the timeline query.

now my question is how should i handle this and keep it as dynamic as possible - so that people could give ranges or specific dates, exclude dates etc.?

my first idea was to create a basic time table where time_id is the primary key and the other field would be the actual date (DATE). i would start from lets say 1900 and go to 2010(for now) with everyday being an entry.

time_id time_date
1  1900-01-01
2  1900-01-02
...
n  2010-12-31

i wanted to do it this way so that when you give something a date on the client side, the server and mysql would just input an time_id or if someone gave a range it would just be a range of time_id's and not actual dates that have to be processed by the server.

does this make sense, or should i approach it a different way? how many records can a single mysql table hold?

thanks
Link to comment
https://forums.phpfreaks.com/topic/32194-timeline-database-setup/
Share on other sites

having limited knowledge of mysql databases, i would not do what you are doing with the extra table to store each day and  as such assign an id value to it and use the id values in other tables, not all the dates are going to be used ( on average not all anyway) so you would be better off storing the selected dates in the main tables and use the BETWEEN sql function to get the range of dates you wish to use such as
[code]
<?php
$query = "SELECT allevents FROM eventtable WHERE eventdate BETWEEN 2001-01-02 AND 2004-01-02";
?>
[/code]


me of little knowledge has now stopped typing
paul i thought about that approach, but with a lot of sources with different date ranges, i figured it would be better to have the one table with everydate represented by an unique id.

im just wondering if there are any drawbacks to my suggested approach
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.