I have a problem I hope someone can help me with... Firstly I have an SQL Query with a "WHERE dateMonthAndYear = $month1"
Already this shows part of what I'm trying to do. The date format in the DB is "YYYY-MM-DD HH:MM:SS". Now I need to dynamically generate a pulldown of months... The range of months in the pulldown are historical, so the last month would be the current month (which should also be the SELECTED option). The first month would be a fixed date, say Jan 2002. The value of the options would probably be like so: <select name="month1"> // <<--- Jump Menu <option value="$PHP_SELF?month1=$current_month" SELECTED>Feb 2002</option> // <<--- Current Month (SELECTED) <option value="$PHP_SELF?month1=$first_month">$first_month_text</option> // <<--- First Month in range <option value="$PHP_SELF?month1=$subsequent_month1">$subsequent_month1_text</option> // <<--- Other months in range ..... // <<--- Other months in range <option value="$PHP_SELF?month1=$current_month" SELECTED>Feb 2002</option> // <<--- Current Month <option value="$PHP_SELF?month1=">ALL</option> // <<--- Empty value will show all </select> I guess the question is, how do I dynamically create the select, based on the above spec (or make $first_month, the first month available in the SQL Query i.e. get the earliest month from the Query), then do the select using ONLY the month and year information. I can do most of the bits in between, just do know how to do the dynamic select for this particular application, or get the date into the SQL where ONLY the month and year are relevant. I am using Pear DB and need this to work on MySQL and Access through Pear so the SQL needs to be quite standard. The above code is not syntaxed properly....just meant for readability. Any ideas are much appreciated as I don't even know where to start with this one. Thanks Simon H -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php