mikebyrne Posted February 6, 2008 Share Posted February 6, 2008 At present my sales figure report just shows all the sales per day. I would like it only to display the days of only the current month and also diplay the month/year on the title of the table. Is there PHP code that will do this on the fly for me as opposed to changing the hard code each month? My code currently is: <form> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"><!-- --></div> <div class="clr"><!-- --></div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="87"><a href="#">date</a></td> <td width="43" align="right"><a href="#">orders</a></td> <td width="118" align="right"><a href="#">revenue</a></td> <td width="569"> </td> </tr> </table> </div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <?php include('adminconnect.php'); $sql = mysql_query("SELECT * FROM sales "); while( $row = mysql_fetch_array($sql) ) { ?> <tr align="left"> <td width="87" align="center"><?php echo $row['Date'];?></td> <td width="43" align="Left"><?php echo $row['Total Orders'];?></td> <td width="118" align="center"><?php echo $row['Revenue'];?></td> </tr> <?php } ?> </table> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data btm finish --> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </form> Quote Link to comment https://forums.phpfreaks.com/topic/89712-dynamic-aspect-to-the-sales-report-based-on-date/ Share on other sites More sharing options...
sasa Posted February 6, 2008 Share Posted February 6, 2008 just in yuor sql add WHERE `Date`>='start_date' AND `Date`<='end_date' Quote Link to comment https://forums.phpfreaks.com/topic/89712-dynamic-aspect-to-the-sales-report-based-on-date/#findComment-459707 Share on other sites More sharing options...
mikebyrne Posted February 6, 2008 Author Share Posted February 6, 2008 Where would I define start and end date? Quote Link to comment https://forums.phpfreaks.com/topic/89712-dynamic-aspect-to-the-sales-report-based-on-date/#findComment-459709 Share on other sites More sharing options...
mikebyrne Posted February 6, 2008 Author Share Posted February 6, 2008 still not to sure what to do with the code Quote Link to comment https://forums.phpfreaks.com/topic/89712-dynamic-aspect-to-the-sales-report-based-on-date/#findComment-460277 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.