Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,685 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,256 people online right now. Registration is fast and FREE... Join Now!




PHP Blog Archives

2 Pages V  1 2 >  
Reply to this topicStart new topic

PHP Blog Archives, help me

we_undertaker
post 28 May, 2008 - 02:49 AM
Post #1


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 34

i have done the entry in my blog.
and now i want to have Archives something ( like this May 2008 ...July 2008 and in May 2008 , it contains all the entry that has been posted in that month..

i just new in PHP , anyone knows , please help me ....
thank you , thank you so much
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 28 May, 2008 - 08:36 AM
Post #2


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


QUOTE(we_undertaker @ 28 May, 2008 - 03:49 AM) *

i have done the entry in my blog.
and now i want to have Archives something ( like this May 2008 ...July 2008 and in May 2008 , it contains all the entry that has been posted in that month..

i just new in PHP , anyone knows , please help me ....
thank you , thank you so much


You'll just want to run a query that selects all the posts that were posted in a certain month. Just pull the month portion from each post date, compare it to the archived date, and display it. If that's not clear let us know.
User is offlineProfile CardPM

Go to the top of the page

we_undertaker
post 28 May, 2008 - 06:13 PM
Post #3


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 34

hi, akozlik.
could you please give me any sample , or can explain clearly about the process (code), because i'm not so understand ...

thank you so much
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 28 May, 2008 - 06:15 PM
Post #4


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


How are you storing the post date in your database?
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 28 May, 2008 - 06:17 PM
Post #5


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,354



Thanked 58 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


I would use the date function to create the file name, & then follow any of these tutorials for saving the file.

http://www.dreamincode.net/forums/showtopic53031.htm
http://www.dreamincode.net/forums/showtopic37133.htm
User is offlineProfile CardPM

Go to the top of the page

we_undertaker
post 28 May, 2008 - 06:30 PM
Post #6


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 34

hi, akozlik .. Yes , i have store my post date in my database
in my entries table , it have Date_Posted . which is store my date and time . sample like this : 2008-05-28 04:05:04 ( date and time ).
plz help me

hi, no2pencil . i read both link that u provided but , i seem not quit understand

Thank you so much
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 29 May, 2008 - 10:42 AM
Post #7


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


QUOTE(we_undertaker @ 28 May, 2008 - 07:30 PM) *

hi, akozlik .. Yes , i have store my post date in my database
in my entries table , it have Date_Posted . which is store my date and time . sample like this : 2008-05-28 04:05:04 ( date and time ).
plz help me

hi, no2pencil . i read both link that u provided but , i seem not quit understand

Thank you so much



You could always string parse the date by pulling the characters at the 6th and 7th position. How are you storing your date in the database. Is it a date, varchar, text, or what?
User is offlineProfile CardPM

Go to the top of the page

we_undertaker
post 29 May, 2008 - 06:39 PM
Post #8


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 34

my one use : datetime

This post has been edited by we_undertaker: 29 May, 2008 - 06:40 PM
User is offlineProfile CardPM

Go to the top of the page

we_undertaker
post 2 Jun, 2008 - 12:28 AM
Post #9


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 34

anyone help me please....
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 10:36 AM
Post #10


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


QUOTE(we_undertaker @ 2 Jun, 2008 - 01:28 AM) *

anyone help me please....


When writing your SQL statement use something like the following

CODE

SELECT *
FROM orders
WHERE order_date between to_date ('2003/01/01', 'yyyy/mm/dd')
AND to_date ('2003/12/31', 'yyyy/mm/dd');


Obviously use your table name and columns based on what month and year you're using.

To select all posts written in May of 2008 you would use

CODE

select * from posts where post_date between to_date('2008/05/01', 'yyyy/mm/dd') and to_date('2008/05/31', 'yyyy/mm/dd');


You'll have to customize that to your needs. Without looking at your code it's difficult to help you with the logic. That should get you started though.
User is offlineProfile CardPM

Go to the top of the page

we_undertaker
post 2 Jun, 2008 - 09:31 PM
Post #11


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 34

hi, akozlik ...
the query to select all the entries that have posted in one month i think i can do it ... but to make for the archive automatic update when the new month comes, it will automatic appear on archive area.( May 2008, April 2008) ( automatic appear June 2008 , when May 2008 is end )

thank you so much.
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 09:37 PM
Post #12


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


When generating your menu that contains the date, you could just make a loop that starts at today's month, and loops down to whatever month you want to end at.

You could also use array. You can check out this article for a good primer on looping through a date. It might take a bit of time to figure out, but it's not too rough.

If you post what you've done so far we can help a bit more.
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:11AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month