PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

how to drag 6 april (last year) to 5 april (this year) from a php mysql database.?

Asked 2010-03-04 07:11:00 by jonathan

i have a field called "r" and r contains date in the format 0000-00-00. i need to query the database and echo all entried that fall within this tax year (UK) so it would be april 6th last year till april 5th this year.
is their a way of doing this without manually changing the dates e.g. so using the YEAR(CURDATE()) or something similar? thanks in advance. First answer to work get best answer

Anwered 2010-03-04 21:04:42 by Robin T

Just use similar query as you would with an integer:

SELECT * FROM tableName WHERE r BETWEEN '2009-04-06' AND '2010-04-05';

Questions and answers provided by the Yahoo Answers Community.