php - 为什么插入内容后我的内容下方的html消失了?

标签 php html css web-site-project

我正在为我的一个模块创建一个网站,每次我从数据库中调用信息以在页面上显示此“内容 div 类”下面的所有 html 都消失了,有人知道为什么吗?

以下是产品的 php 页面:

<link rel="stylesheet" href="css/productiontable.css">
<?php 
error_reporting(0);
require './db/connect.php';
include './includes/header.php'; 

?>
<h2>Productions</h2>

<div class="productiontable">
    <h3>What's on at this theatre</h3>
    <?php 
        if($result = $connection->query("SELECT * FROM Production")){
                        if($count = $result->num_rows){

                            while($row = $result->fetch_object()){
    ?>
    <div class="centredinfo">
        <div class="coloumns">
            <div class="productionname">
                <?php echo $row->ProductionName; ?>
            </div>
            <div class="productiontype">
                <?php echo $row->ProductionType; ?>
            </div>
            <div class=""></div>
            <div class="clear"></div>
        </div>
     </div>            

    <?php           }
    $result->free();
            }
    } 
    echo $result; 
    mysqli_close($connection);
    ?>

    <p>please click on productions for more info</p>
</div>               

<?php include './includes/footer.php'; ?>

这是整个站点的 maincss:

@import url(http://fonts.googleapis.com/css?          family=Indie+Flower|Lobster|Pacifico|Dosis);

/*Reseting the design on the page*/
*{padding: 0; margin: 0;}

/*Whole Page*/
body{
    font-family: 'Dosis';
    font-size: 14px;
    background-color: bisque;
}

/*The box putting all information in middle*/
.container{
    width: 960px;
    margin: auto;
}

/*Header*/
.header{
    width: 945px;
    text-align: center;
    font-size: 45px;
    background-color: grey;
    color: white;
    -webkit-box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    -moz-box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    border: 2px black solid;
    margin-top: 10px;
    padding: 5px;
    height: 82px;
    font-family: 'Pacifico';
}
.theatreleft, .theatreright{
    width: 80px; height: 80px;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
}
.theatreleft{float: left;}
.theatreright{float: right;}

/*Navigation*/
.navigation{
    height: 40px;
    width: auto;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    background: linear-gradient(top, grey 0%, black 100%); 
    background: -webkit-linear-gradient(top, grey 0%, black 100%); 
    background: -moz-linear-gradient(top, grey 0%, black 100%); 
    background: -ms-linear-gradient(top, grey 0%, black 100%); 
    margin-top: 10px;
    border: black 2px solid;
}
.navigation li{
    list-style: none;
    float: left;
    display: inline-block;
    height: 40px;
    position: relative;
}
.navigation li a{
    display: block;
    text-decoration: none;
    font-weight: bold;
    color: white;
    font-size: 15px;
    padding: 0;
    margin: 0;
    line-height: 30px;
    text-align: center; 
}
.navigation li:first-child a{border-left: none;}
.navigation li:last-child a{border-left: none;}
.navigation li:hover > a{color: #00ccff;}
.navigation ul li a{
    width: 100px;
    text-align: center;
    padding-top: 5px;
    margin-left: 25px;
    margin-right: 25px;
}
/*Sub Menu*/  
.navigation li ul{
     position: absolute;
     opacity: 0;
     background: black;
     top: 40px;
     border-radius: 5px;
     -webkit-border-radius: 5px;
     -moz-border-radius: 5px;
     -ms-border-radius: 5px;
}
.navigation ul li:hover > ul{
     opacity: 1;
}
.navigation ul li ul li{
     height: 0;
     overflow: hidden;
     padding: 0;
     border-bottom: 1px solid grey;
}
.navigation ul li:hover > ul li{
     height: auto;
     overflow: visible;
}
.navigation ul li ul li a{
     width: 100px;
     margin-left: 22px;
     border: none;
     text-align: center;
}
.navigation ul li:first-child a{
     border: none; 
}

/*Content Below the navigation*/
.content{
    height: 500px;
    background-color: grey;
    -webkit-box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    -moz-box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    border: 2px black solid;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    margin-top: 10px; 
 }

 /*The paragraph element of the content box*/
 .content p{
    padding: 15px;
    color: white;
    width: 94%;
    margin: 10px;
 }

 /*Footer at the bottom*/
 .footer{
    background-color: grey;
    -webkit-box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    -moz-box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    box-shadow: inset -3px 1px 30px 13px rgba(0,0,0,0.37);
    border: 2px black solid;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    margin-top: 10px;
    text-align: center;
    color: white;
    font-size: 18px;
    margin-bottom: 10px;
 }

和生产表的CSS

@import url(http://fonts.googleapis.com/css?family=Dosis);

h2{
    text-align: left;
    color: white;
    font-family: 'Dosis';
    margin: 10px;
    font-size: 32px;
}
h3{
    font-size: 18px;
    color: white;
    margin: 20px;
}
.centredinfo{
    width: 900px;
}
.coloumns{
    width: 600px;
    margin: 0 auto;
}
.coloumns div{
    width: 300px;
    float: left;
}

有人知道为什么吗?

非常感谢

最佳答案

我删除了 error_reporting(0);给我错误并显示 echo $result;是导致问题的原因,我已将其删除,现在可以正常使用了。非常感谢:)

关于php - 为什么插入内容后我的内容下方的html消失了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28983851/

相关文章:

php - 检查 Php 变量是否正确的 MySql 类型(为插入查询做准备)

PHP - 从 html 复选框中选择 sql

javascript - Accordion 上下箭头

css - 当子 div 不能并排放置时,让 div 清晰?

javascript - Div 与前一个 div 重叠并破坏了前一个 div 的功能

php - Linux 上 LiteSpeed Web 服务器中文件的正确路径

php - 如何将 mysql 数组传递给 jquery php

html - 一个 CSS 类覆盖了另一个不相关类的链接样式

PHP PayPal API 快速结账

html - 在 appengine 中使用 "onclick"和单选按钮