0

here is the database

http://img214.imageshack.us/img214/3852/23405199.jpg


here is the form

http://img254.imageshack.us/img254/3518/60904005.jpg

if the search click i want the selected month in the combobox search from the database table under departure field month and it will fetch on the table..

for example:
<--departure-->
09/10/2010
10/10/2010
10/11/2010

<select name=\"month\">
<option value=\"01\">January</option>
<option value=\"02\">February</option>
<option value=\"03\">March</option>
<option value=\"04\">April</option>
<option value=\"05\">May</option>
<option value=\"06\">June</option>
<option value=\"07\">July</option>
<option value=\"08\">August</option>
<option value=\"09\">September</option>
<option value=\"10\">October</option>
<option value=\"11\">November</option>
<option value=\"12\">December</option>
</select>
<input type=\"submit\" name=\"search\" value=\"Submit\">

example selected month is october it should fetch the following:

10/10/2010
10/11/2010

i hope you get it..sorry for my bad instruction :)

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by mschroeder
0

If you want to search on the month, then you probably need something like:

Select * from $table where departure like '$month/%' order by departure
0

thanks for the reply but it is not what i want..
i want to extract the date in the database( month/ day/ year) then fetch all the month then that month will be the target of the month selected in the form..

for example:
<--departure-->
09/10/2010
10/10/2010
10/11/2010

after extracting:
09
10
10

example input in the form:
October which value is 10

then the result will be:
10
10

0

Sorry, I don't understand what you are trying to accomplish so unless you can explain it differently, I give up.

1

If I follow correctly, when the user selects a month from the drop down, a two digit representation of the month is passed to the script. 01, 02, 03, etc. and you wish to then pull anything departing in that month.

You can do this relatively easily in SQL using something like this:

SELECT * FROM table WHERE MONTH( STR_TO_DATE(departure, '%m/%d/%Y') ) = 10

Where 10 is the integer value of the month supplied but the form. Beware that this is going to pull anything with month = 10 for ANY year.

***I assume you're departure column is stored as a string and is not using the DATE column type. Since it is not a supported MySQL date representation.

Edited by mschroeder: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.