<?
	$relative_pro_sql = "select * from ls_products where ID=".$products_rows['ID']." order by Num desc ";
	$relative_pro_query=$opendb->query($relative_pro_sql);
	$relative_pro_rows=mysql_fetch_assoc($relative_pro_query);
	
	$relative_pro_name = $relative_pro_rows['productName'];
	$relative_pro_ItemNo = $relative_pro_rows['productItemNo'];
	
	$relative_cate_sql = "select * from ls_products where ID=".$relative_pro_rows['productID']." order by Num desc ";
	$relative_cate_query=$opendb->query($relative_cate_sql);
	$relative_cate_rows=mysql_fetch_assoc($relative_cate_query);
	
	$relative_pro_cate = "";
	
	if($relative_cate_rows['cateName'] != null){
		$relative_pro_cate = $relative_cate_rows['cateName'];
	}else if($relative_cate_rows['midcateName'] != null){
		$relative_pro_cate = $relative_cate_rows['midcateName'];
	}else if($relative_cate_rows['subcateName'] != null){
		$relative_pro_cate = $relative_cate_rows['subcateName'];
	}
	
	$relative_new_sql = "SELECT * FROM ls_news WHERE newsTitle LIKE  '%".$relative_pro_name."%' OR newsTitle LIKE '%".$relative_pro_ItemNo."%' OR newsTitle LIKE '%".$relative_pro_cate."%' OR newsText LIKE  '%".$relative_pro_name."%' OR newsText LIKE '%".$relative_pro_ItemNo."%' OR newsText LIKE '%".$relative_pro_cate."%' LIMIT 0, ".$relativeNewNum;
	
	$relative_new_query=$opendb->query($relative_new_sql);
	$relative_new_num = mysql_num_rows($relative_new_query);
	
	if($relative_new_num  != 0){
		$relative_new = "<ul class='p_list_ul2'>";
		while($relative_new_rows=mysql_fetch_assoc($relative_new_query)){
			$relative_new .= "<li><a href='../".$newsshowFolders."/news".$relative_new_rows['ID'].".html' title='".$relative_new_rows['newsTitle']."'>".$relative_new_rows['newsTitle']."</a></li>";
		}
		//数量不够其它新闻补充
		$for_num = $relativeNewNum - $relative_new_num;
		if($for_num > 0){
			$relative_new_another_sql = "SELECT * FROM ls_news WHERE newsTitle NOT LIKE '%".$relative_pro_name."%' AND newsTitle NOT LIKE '%".$relative_pro_ItemNo."%' AND newsTitle NOT LIKE '%".$relative_pro_cate."%' AND newsText NOT LIKE '%".$relative_pro_name."%' AND newsText NOT LIKE '%".$relative_pro_ItemNo."%' AND newsText NOT LIKE '%".$relative_pro_cate."%' LIMIT 0, ".$for_num;
			$relative_new_another_query=$opendb->query($relative_new_another_sql);
			while($relative_new_another_rows = mysql_fetch_assoc($relative_new_another_query)){
				$relative_new .= "<li><a href='../".$newsshowFolders."/news".$relative_new_another_rows['ID'].".html' title='".$relative_new_another_rows['newsTitle']."'>".$relative_new_another_rows['newsTitle']."</a></li>";
			}
		}
		$relative_new .= "</ul>";
	}
	
	if($relative_cate_rows['cateName'] != null){
		$relative_new = str_replace('../','../../',$relative_new);
	}else if($relative_cate_rows['midcateName'] != null){
		$relative_new = str_replace('../','../../../',$relative_new);
	}else if($relative_cate_rows['subcateName'] != null){
		$relative_new = str_replace('../','../../../../',$relative_new);
	}
?>