<?php
//require_once("constant.php");
$allProducts = array(array("productPic"=>'',"productItemNo"=>'',"productName"=>'',"productSpecification"=>'',"productPicPath"=>''));
$productPicPath = array(array());

$i=0;
$x=0;
$y=1;
$sql = "SELECT * FROM ls_products WHERE cateName IS NOT NULL ORDER BY Num";
$query = $mydb->query($sql);
while($query_array = mysql_fetch_array($query))
{
	$productPicPath[$x][0] = $query_array["cateFolders"];
	$sql = "SELECT * FROM ls_products WHERE midcateName IS NOT NULL AND midcateID =".$query_array["ID"]." ORDER BY Num";
	$midQuery = $mydb->query($sql);
	while($midQuery_array = mysql_fetch_array($midQuery))
	{	
		$productPicPath[$x][$y] = $midQuery_array["midcateFolders"];
		$sql = "SELECT * FROM ls_products WHERE productPic IS NOT NULL AND productName IS NOT NULL AND productID =".$midQuery_array["ID"]." ORDER BY Num ";
		$subQuery = $mydb->query($sql);
		while($subQuery_array = mysql_fetch_array($subQuery))
		{
			$allProducts[$i]["productPic"]=$subQuery_array["productPic"];							//产品图片名
			$allProducts[$i]["productItemNo"]=$subQuery_array["productItemNo"];						//产品编号
			$allProducts[$i]["productName"]=$subQuery_array["productName"];							//产品名称
			$allProducts[$i]["productSpecification"]=$subQuery_array["productSpecification"];		//产品详细说明
			$allProducts[$i]["productPicPath"]=$productPicPath[$x][0]."/".$productPicPath[$x][$y];	//产品所在路径
			$i++;
		}
		$y++;
	}
	$x++;
}

$allPage = ceil(count($allProducts)/$PageNum);
?>