データベースからカバーされているエリアのリストをエコーしています。リストには、データベースから取得した見出しとサブ見出しがあります。
$area_shire = '';
$area_district = '';
$area_name = '';
while($rows = mysql_fetch_array($query)):
if($rows['area_shire'] != $area_shire) {
echo '<h1>'.$rows['area_shire'].'</h1>';
$area_shire = $rows['area_shire'];
}
/* same for district using h2 and name using h3 */
endwhile;
各結果をハイパーテキスト URL にしたいので、追加しました
$area_shire_url = str_replace(' ', '_', $area_shire);
$area_district_url = str_replace(' ', '_', $area_district);
$area_name_url = str_replace(' ', '_', $area_name);
各エコーを次のように変更しました
echo '<a href=\"Tree_Surgery_'.$area_shire_url.'.php\"><h2>'.$rows['area_shire'].'<br></h2>';
$area_shire = $rows['area_shire'];}
/* same for district using h2 and name using h3 */
これはまったく機能していませんか?