Welcome to WebmasterWorld Guest from 54.196.224.166

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Getting my head round dates with sql.

     

johnyfav

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

10+ Year Member



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

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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

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

10+ Year Member



That is amazing.

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

Thank you kindly!