...

View Full Version : Splitting the Date Field



boznovocastrian
12-16-2008, 03:02 AM
One of the pages of my site that I am developing a user types in for example 1992 in the textbox with a name "data_entryYear", When I click on the submit button, I want the database to search for all entries of 1992 from the database. The format of the date field in my database is yyyy-mm-dd

Thanks in advance for any help

Boz

Last Page
12-16-2008, 03:45 AM
I assume that you have MySQL database manager. In that case try to use MySQL function "YEAR".

SELECT * from Your_table_name WHERE YEAR(DATE_type_field_name) = $variable_representing_year;

I have not tested this.

boznovocastrian
12-16-2008, 04:59 AM
Gracias tanto



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum