erikjan Posted March 6, 2007 Share Posted March 6, 2007 Can someone please help me? Thank you in advance. Withe the following code I retrieve data from a database, and do stuff with it. There are three sql statements. How can I get the formatted output with only one statement? $ordernumber=("0701"); $SQL_statement="SELECT COUNT(*) AS nu, SUM(amountofboxesStunningSofia) AS Stu_Sof, SUM(amountofboxesSmokingJoe) AS Smo_Joe [etc . . .] WHERE ordernumber LIKE '$ordernumber%'"; $resultset=mysql_query($SQL_statement); ... show data for the month January ... $ordernumber=("0702"); $SQL_statement="SELECT COUNT(*) AS nu, SUM(amountofboxesStunningSofia) AS Stu_Sof, SUM(amountofboxesSmokingJoe) AS Smo_Joe [etc . . .] WHERE ordernumber LIKE '$ordernumber%'"; $resultset=mysql_query($SQL_statement); ... show data for the month Februari ... $ordernumber=("0703"); $SQL_statement2="SELECT COUNT(*) AS nu, SUM(amountofboxesStunningSofia) AS Stu_Sof, SUM(amountofboxesSmokingJoe) AS Smo_Joe [etc . . .] WHERE ordernumber LIKE '$ordernumber%'"; $resultset2=mysql_query($SQL_statement2); ... show data for the month March ... Link to comment https://forums.phpfreaks.com/topic/41435-formatting-data/ Share on other sites More sharing options...
iceman400 Posted March 6, 2007 Share Posted March 6, 2007 the only thing that changes in the sql statements is the ordernumber right? y dont u put the ordernumbers in an array and use a foreach loop? Link to comment https://forums.phpfreaks.com/topic/41435-formatting-data/#findComment-200725 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.