nizmy Posted October 23, 2008 Share Posted October 23, 2008 hye everyone.. i want to select a particular month, then display the details in the table...but i got problems with that..can anyone help..?? ------------------------------------------------------ the coding looks like this.. <select name="month_no"> <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> how do i select the particular month, then display it..?? i using session to got the "month_no" $month_no=$_SESSION[month_no]; ex: if i choose december, which is 12, it will display the details of the payment in the that month... all the details about payment in the payment_trans table thnx in advance Link to comment https://forums.phpfreaks.com/topic/129697-sql-statement-problems-with-select-a-particular-monthanyone/ Share on other sites More sharing options...
Maq Posted October 23, 2008 Share Posted October 23, 2008 how do i select the particular month, then display it..?? i using session to got the "month_no" $month_no=$_SESSION[month_no]; Let me get this right you want to actually display the word from the corresponding number? Then use this: echo "Month '$i' is: " . date( "F" , mktime( 0 , 0 , 0 , $month_no ) ); Link to comment https://forums.phpfreaks.com/topic/129697-sql-statement-problems-with-select-a-particular-monthanyone/#findComment-672464 Share on other sites More sharing options...
Barand Posted October 23, 2008 Share Posted October 23, 2008 SELECT ... WHERE MONTH(datecol) = $month_no. If you have more than one year's data you need to check for YEAR(datecol) also. Remove leading zeros from option values. Link to comment https://forums.phpfreaks.com/topic/129697-sql-statement-problems-with-select-a-particular-monthanyone/#findComment-672564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.