Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从数据库中获取标题和副标题的动态表_Php_Mysql - Fatal编程技术网

Php 从数据库中获取标题和副标题的动态表

Php 从数据库中获取标题和副标题的动态表,php,mysql,Php,Mysql,我在重复从数据库中获取的超文本链接所涵盖的区域列表 $area_shire = ''; $area_district = ''; $area_name = ''; while($rows = mysql_fetch_assoc($query)) { if ($rows['area_shire'] != $area_shire) { $area_shire = $rows['area_shire']; $area_shire_url = str_repl

我在重复从数据库中获取的超文本链接所涵盖的区域列表

$area_shire = '';
$area_district = '';
$area_name = '';

while($rows = mysql_fetch_assoc($query)) {

    if ($rows['area_shire'] != $area_shire) {
        $area_shire = $rows['area_shire'];
        $area_shire_url = str_replace(' ', '_', $area_shire);
        echo '<h2><a href=Driveway_Cleaning_'.$area_shire_url.'>'.$area_shire.'</a></h2><br>';
    }  


    if ($rows['area_district'] != $area_district) {
        $area_district = $rows['area_district'];
        $area_district_url = str_replace(' ', '_', $area_district);
        echo '<h3><a href=Driveway_Cleaning_'.$area_district_url.'>'.$area_district.'</a></h3><br>';

    }  


    if ($rows['area_name'] != $area_name) {
        $area_name = $rows['area_name'];
        $area_name_url = str_replace(' ', '_', $area_name);
        echo '<a href=Driveway_Cleaning_'.$area_name_url.'>'.$area_name.'</a><br>';
    }  
    }
?>
$area_shire='';
$area_district='';
$area_name='';
while($rows=mysql\u fetch\u assoc($query)){
如果($rows['area\u shire']!=$area\u shire){
$area_shire=$rows['area_shire'];
$area_shire_url=str_replace(“,”,$area_shire);
回声“
”; } 如果($rows['area\u district'!=$area\u district){ $area_district=$rows['area_district']; $area_district_url=str_replace(“,”,$area_district); 回声“
”; } 如果($rows['area\u name']!=$area\u name){ $area_name=$rows['area_name']; $area\u name\u url=str\u replace(“,”,$area\u name); 回声“
”; } } ?>
这给了我一个线性输出

西米德兰兹 伯明翰 海港
艾德巴斯顿
莫斯利

达德利 哈莱索文
塞格利

沃里克郡
我试图将输出放在一个动态表中,以便每个地区(例如)Dudley从一个新列开始,因此位于伯明翰的右侧,而不是下方。我尝试的一切都会影响输出的顺序。有什么想法吗

那么为什么不尝试使用HTML表呢?或者把每一个分组放在一个扇形分区中,这样它们就可以彼此并排放置了?我的主要建议是先制定HTML模板,然后制定如何将动态数据注入其中。

对数据库的查询是什么?