Jump to content

Displaying data on a weekly basis


vishak

Recommended Posts

Are you building a static website, just using HTML and CSS, or are you pulling this information from a database (and using something like PHP)?

 

I recently did a tutorial on using PHP/MySQLi to do pagination (source code is here: http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/ and the two part screencast is on the KillerSites University http://www.killersites.com/university under PHP > Misc PHP). That may give you a direction to go, since pagination is pretty similar to what you want to do.

Link to comment
Share on other sites

Hello,

 

I have a table with fields date,day,and some data for each day.

I want to display the data on a weekly basis, (ie from Monday to Friday) along with options for next week and

previous week.

 

Could someone help me with this?

 

Why not get a twitter account and build/download a script to display your latest tweets?

Link to comment
Share on other sites

What I am storing is some data for each day of the month.

I want to retrieve it week by week.It should include a next week and previous week button,so that a user can navigate accordingly.

That's what i have in mind.

At present I have done it using a vertical scroll bar and included the entire information.

Link to comment
Share on other sites

What I am storing is some data for each day of the month.

I want to retrieve it week by week.It should include a next week and previous week button,so that a user can navigate accordingly.

That's what i have in mind.

At present I have done it using a vertical scroll bar and included the entire information.

 

Are you building a static website, just using HTML and CSS, or are you pulling this information from a database (and using something like PHP)?

Link to comment
Share on other sites

I had mentioned in my first post that I am using a table, so of course a database.

Sorry If hadn't posted it explicitly.

 

My table structure is like this

date day ........data...........

2010-01-02 Monday

2010-01-03 Tuesday

2010-01-04 Wednesday

2010-01-05 Thursday

2010-01-06 Friday

2010-01-07 Monday

2010-01-08 Tuesday

2010-01-09 Wednesday

 

And now i have to display data week by week,after reading from the database.For example if today is 2nd of January (assume it is a monday)then

display data till friday(till 6th of Jan).

Then have a next and previous week button to display data accordingly.

Link to comment
Share on other sites

Sorry, I think I read table as "HTML table" and missed that.

 

Probably the easiest way to do things would be to assign each week an week value which you can pass via the url: yourpage.php?week=2. Based on the id value, PHP would determine which week you want to show (in this case, days 8-14 of January) and display them. Your previous week link would be "yourpage.php?week=1" and your next week would be "yourpage.php?week=3". You could also build in support for different years as well -- perhaps "yourpage.php?week=3" would default to 2010 since that's the current year, but if you add an additional value in the url, "yourpage.php?week=3&year=2011" it would specify the year as well.

 

I obviously don't have a specific example using a calendar, but you might want to look at http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/ (or there's a link in that article to a version that uses regular mysql) where I explain some pagination basics.

 

For the mysql query where you grab the data from the database, using LIMIT can be helpful. http://php.about.com/od/mysqlcommands/g/Limit_sql.htm

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.

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

Loading...
×
×
  • Create New...