Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi Larry and everyone,

I have really painted myself into a corner with this one.image.thumb.png.d96fc34f59d37295159e0684a108de49.png

Above is the database that I created for a timeline.  The issue is that not all of the dates at my disposition have days and months.  Some are just years.  Hence, I had to make a separate column for years only.

What I want to do is create a timeline using tables so that any year that has either a YYYY date and/or a YYYY-MM-DD date appears in chronological order.  I tried it with a for loop starting at $i = 1700 - 2000 which works for the first year but the  

while ($enquiry3 = @mysqli_fetch_array($enquiry2))

will only iterate once and then stops.  The alternative is to use MySQL such as:

for($i = 1700; $i <= 2000; i++)


       $enquiry = "SELECT * from Timeline WHERE Year = $i ORDER BY Year ASC"


which works OK for getting the year only files.  Then we need to get the full date files so we try:


for($i = 1700; $i <= 2000; i++)


      $enquiry = " SELECT * from Timeline WHERE Date = YEAR($i, %Y) ORDER BY Date ASC"


 ....but the date function doesn't seem to work.

Any ideas???




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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