<?
	$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=sprintf("SELECT * FROM ls_news WHERE newsTitle LIKE  '%%%%s%%' OR newsTitle LIKE '%%%%s%%' OR newsTitle LIKE '%%%%s%%' OR newsText LIKE  '%%%%s%%' OR newsText LIKE '%%%%s%%' OR newsText LIKE '%%%%s%%' LIMIT 0,".$relativeNewNum,
				GetSQLValueString($relative_pro_name, "text"),
				GetSQLValueString($relative_pro_ItemNo, "text"),
				GetSQLValueString($relative_pro_cate, "text"),
				GetSQLValueString($relative_pro_name,"text"),
				GetSQLValueString($relative_pro_ItemNo,"text"),
				GetSQLValueString($relative_pro_cate,"date")
			);
	
	$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=sprintf("SELECT * FROM ls_news WHERE newsTitle NOT LIKE '%%%%s%%' AND newsTitle NOT LIKE '%%%%s%%' AND newsTitle NOT LIKE '%%%%s%%' AND newsText NOT LIKE '%%%%s%%' AND newsText NOT LIKE '%%%%s%%' AND newsText NOT LIKE '%%%%s%%' LIMIT 0, ".$for_num,
				GetSQLValueString($relative_pro_name, "text"),
				GetSQLValueString($relative_pro_ItemNo, "text"),
				GetSQLValueString($relative_pro_cate, "text"),
				GetSQLValueString($relative_pro_name,"text"),
				GetSQLValueString($relative_pro_ItemNo,"text"),
				GetSQLValueString($relative_pro_cate,"date")
			);
			
			$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);
	}
?>