<?
//if($search=="") {$strSQL = "SELECT * FROM gdctb WHERE (inorderdate >= '$start_time' and inorderdate <= '$end_time')";}
//else if($search=="work_type"){$strSQL = "SELECT * FROM gdctb WHERE ( work_type LIKE '%".$_POST["work_type"]."%')";}
//else if($search=="name_design"){$strSQL = "SELECT * FROM gdctb WHERE ( name_design LIKE '%".$_POST["name_design"]."%')";}
//else if($search=="status"){$strSQL = "SELECT * FROM gdctb WHERE ( status LIKE '%".$_POST["status"]."%')";}
$total_price=0;
$total_paper=0;
$total_creative=0;
$total_quality =0;
$avg_creative=0;
$avg_quality=0;
$i=1;
$strSQL = "SELECT * FROM gdctb WHERE (inorderdate >= '$start_time' and inorderdate <= '$end_time')
AND (work_type LIKE '%".$_POST["work_type"]."%')
AND (name_design LIKE '%".$_POST["name_design"]."%'
OR name_design2 LIKE '%".$_POST["name_design"]."%'
OR name_design3 LIKE '%".$_POST["name_design"]."%'
OR name_design4 LIKE '%".$_POST["name_design"]."%'
OR name_design5 LIKE '%".$_POST["name_design"]."%')
AND ( status LIKE '%".$_POST["status"]."%')
AND ( title LIKE '%".$_POST["txtKeyword"]."%') ORDER BY id ASC";
//$strSQL = "SELECT sum(price) sprice from gdctb";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<?
while($objResult = mysql_fetch_array($objQuery))
{
$total_price = $total_price + $objResult["price"];
$total_paper = $total_paper + $objResult["paper"];
$total_creative = $total_creative + $objResult["creative"];
$total_quality = $total_quality + $objResult["quality"];
$sql_c = mysql_query("SELECT AVG(creative) as AVGC FROM gdctb"); //avg_creative
$table1 = mysql_fetch_array($sql_c);
$avg_creative=$table1['AVGC'];
$sql_q = mysql_query("SELECT AVG(quality) as AVGQ FROM gdctb"); //avg_quality
$table2 = mysql_fetch_array($sql_q);
$avg_quality=$table2['AVGQ'];
?>