You are here: Re: Getting an MySQL first day and last day statement « PHP SQL « IT news, forums, messages
Re: Getting an MySQL first day and last day statement

Posted by Steve on 02/23/06 23:32

> Thanks for this answer. I guess my question is a little more general.
> Let's say the month isn't hard-coded, but I am guaranteed to have it in
> the form
>
> $monthVar = "YYYY-MM-DD HH:MI:SS.0";
>
> How would I write a MySQL query that searches between the first and
> last days of the month represented by the above?

Ah, a different question with a different answer. Using PHP & MySQL:

$sql = "SELECT * FROM trips WHERE MONTH( startdate ) = MONTH(
\"$monthVar\" ) AND YEAR( startdate ) = YEAR( \"$monthVar\" )";

---
Steve

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация