homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Getting my head round dates with sql.
johnyfav




msg:3131668
 1:55 pm on Oct 23, 2006 (gmt 0)

I've been scratching my head about this for a while now.

I have a my sql DB that has a kind of diary in it.

I use a timestamp in this format 0000-00-00 00:00:00

OK this is what I want to do. Go through each day of the month and if there is an entry in the database for that day do something if not dont do anything.

It's just how I loop through the days of each month and stuff.

Maybe its the creation of the dates i'm stuck with.

Any help would be greatly appreciated!

 

eelixduppy




msg:3131747
 2:57 pm on Oct 23, 2006 (gmt 0)

Try a query like this:

$query = "SELECT * FROM table WHERE MONTH(timestamp) = '10'";

This should select all the rows where the month is '10'

Good luck! :)

johnyfav




msg:3132757
 9:33 am on Oct 24, 2006 (gmt 0)

That is amazing.

I had to do some other stuff too but that really helped me find the sql functions page!

Thank you kindly!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved