Hello everyone. Hope all is going well. I have a table that displays the contents of a MySQL query. This all works perfectly well. My question is since there is an date column in it, is there a way to have the displayed table shift daily to place the current row always at the top but still allow for scrolling of previous and future dates.
Thanks in advance
CHEERS
Reposition a MySQL data table to todays date
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Reposition a MySQL data table to todays date
Don't really understand 
-
Todlerone
- Forum Commoner
- Posts: 96
- Joined: Sun Oct 28, 2007 10:20 pm
- Location: Hamilton, Ontario, Canada
Re: Reposition a MySQL data table to todays date
Sure. I have a MySQL populated table. One of the columns is for a corresponding date. This is a schedule for a baseball league. So basically there is date, park and visitor vs. home columns. I was just wondering if my table can shift daily to place the closest date (row) at the top of the visible table instead of having it with the first row of the populated table. I don't want to lose the data (rows) previous to the current date, just shift them out of view. This way when someone comes to the web site the schedule reflects the games coming up soon and prevents them from having to scroll down to find the current games. This help?
CHEERS and thank-you for the response.
CHEERS and thank-you for the response.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Reposition a MySQL data table to todays date
If I understand you correctly, you could just use ORDER BY in your query when you fetch the data.
Am I missing the point?
Am I missing the point?
-
Todlerone
- Forum Commoner
- Posts: 96
- Joined: Sun Oct 28, 2007 10:20 pm
- Location: Hamilton, Ontario, Canada
Re: Reposition a MySQL data table to todays date
I actually do have order by date in the query. Sorry hard to describe my thoughts. My wife says I have the same problem. My response to her is....hello MALE. Just kidding. Say I have a table with each row starting with a date to reflect each day of the year. Now say july 3rd I go to visit the web page. What I want to do is have the table (the visible part) align the data within itself so that the July 3rd row is at the top of the visible table and if I want to see the other part of the data I just scroll. Basically the table will be quite long given the number of games in the table. Think of it like the Range Finder game in The Price IS Right. (don't we all watch this show @11:00am when we call in to work sick..hehe..for us Eastern time people). The same effect happens in many web pages where you can select an element and it throws you down the web page to that part of it only then you select the "Back to top" link.
This help..?
This help..?
Re: Reposition a MySQL data table to todays date
Sure - you ORDER by date in the query as previously stated. Set a variable in php to represent the current date then when building your table html (which I presume you do in a loop) add in a conditional to simply add an anchor link to the table row corresponding to that variable. Then refresh the page with the anchor appended to the URL.
-
Todlerone
- Forum Commoner
- Posts: 96
- Joined: Sun Oct 28, 2007 10:20 pm
- Location: Hamilton, Ontario, Canada
Re: Reposition a MySQL data table to todays date
Thank-you and aceconcepts for your patience and help....CHEERS I will try it.timsewell wrote:Sure - you ORDER by date in the query as previously stated. Set a variable in php to represent the current date then when building your table html (which I presume you do in a loop) add in a conditional to simply add an anchor link to the table row corresponding to that variable. Then refresh the page with the anchor appended to the URL.