首页 >后端开发 >php教程 > 请教以上代码哪里有有关问题

请教以上代码哪里有有关问题

WBOY
WBOY原创
2016-06-13 13:14:20974浏览

请问以下代码哪里有问题

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?PHP $id=$_GET['number'];

include("conn.php");

$Date = date("YmdHis");
$Filename = $Date.".csv";
$Table = isset($_GET['tid'])?$_GET['tid']:''; 
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=".$Filename);
echo "SKU,product-name,sum(quantity),\r\n";
 $Sql = "select *,sum(`quantity-purchased`) from sale_orders WHERE `number`=$id group by `jj_sku`";
 $Result = mysql_query($Sql);
 
 while($rs = mysql_fetch_array($Result) ){
 
  $j_sku=$rs['jj_sku'];
   $Sqlpr = "SELECT `product-name` FROM `product_co` WHERE `jj_sku`=$j_sku";
 $Resulta = mysql_query($Sqlpr,$conn);
 $resultaa= mysql_fetch_row($Resulta);
$pro-nm=$resultaa[0];

 echo $rs['jj_sku'].",".$pro-nm.",". $rs['sum(`quantity-purchased`)']." \r\n ";
    
 }

?>






  $Sqlpr = "SELECT `product-name` FROM `product_co` WHERE `jj_sku`=$j_sku";
 $Resulta = mysql_query($Sqlpr,$conn);
 $resultaa= mysql_fetch_row($Resulta);
$pro-nm=$resultaa[0];
我觉得以上代码有问题,请问应该怎么写呢?

------解决方案--------------------
$Sqlpr = "SELECT `product-name` FROM `product_co` WHERE `jj_sku`='$j_sku'";
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn