国別検索
$sql = "select area from wine_country group by area order by area"; $result = mysql_query($sql,$con);//クエリを発行する $row = mysql_num_rows($result);//取得したレコード件数を数える $i=0; while($i < $row){ $area = mysql_result($result,$i,0); print "
$area
\n";
print "\n";
$sql2 = "select a.id,a.country,b.country_id,b.id,a.area from wine_country as a,wine_tsukurite as b
where b.country_id = a.id and b.id != '' and a.area = '$area' group by a.country order by a.country";
$result2 = mysql_query($sql2,$con);//クエリを発行する
$row2 = mysql_num_rows($result2);//取得したレコード件数を数える
$k=0;
while($k < $row2){
$id = mysql_result($result2,$k,0);
$country = mysql_result($result2,$k,1);
if($k != 0){ print " / "; }
print "$country";
$k++;
}
print "
=$amazon ?>