Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.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_Html - Fatal编程技术网

我的PHP代码干扰了我的页脚

我的PHP代码干扰了我的页脚,php,html,Php,Html,我正在创建一个电子商务商店,我认为我的php代码运行良好,我可以看到我页面中的所有信息,但代码干扰了我的页脚,下图: 我的php主页代码: 我的php产品代码: <?php include('cms/conectar.php'); ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document<

我正在创建一个电子商务商店,我认为我的php代码运行良好,我可以看到我页面中的所有信息,但代码干扰了我的页脚,下图:

我的php主页代码:

我的php产品代码:

<?php include('cms/conectar.php');
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<style>
.prodColuna { text-align:center; width:300px; float:left; height:100%  }
</style>


<?php
$consulta = mysql_query("SELECT * FROM  `livros-desporto` ");

 if (isset($_POST['buscar'])) {
    $consulta = mysql_query("
        SELECT * FROM `livros-desporto` where name like '%".$_POST['buscar']."%'
    ");
}

while ($linha = mysql_fetch_array($consulta)) {
    $id = $linha['ID'];
    $modelo = $linha['Model'];
    $nome = $linha['Name'];
    $categoria = $linha['Category'];
    $imagem = $linha['Image'];
    $manufactura = $linha['Manufacturer'];
    $preco = $linha['Price'];
    $quantidade = $linha['quantity']
    // $adicionar = '<a href="carrinho.php?id='.$linha['ID'].'"title="'.$linha['ID'].'">
    //  Adicionar </a>'
?>
<div id="espaço">  
    <!-- Categorias principais -->
    <div id="baixo">
        <div class="prodColuna">
            <table width="200" height="300" border="1">
                <tr>
                    <th colspan="2" scope="col" height="39"><?php echo $nome ?></th>
                </tr>
                <tr>
                    <td height="35" colspan="2"><?php echo $preco ?></td>
                </tr>
                <tr>
                    <td height="184" colspan="2"><?php echo $modelo ?></td>
                </tr>
                <tr>
                    <td width="39"><?php echo $categoria ?></td>
                    <td width="145" height="30"><?php echo $id ?></td>
                </tr>
            </table>
            <br/>
        </div>
<?php } ?>
    </div>  
</div>
</body>
</html>

无标题文件
.prodColuna{文本对齐:中心;宽度:300px;浮点:左;高度:100%}

您在
while($linha=mysql\u fetch\u数组($consulta))
循环中打开了2个div,但没有关闭它们:

<div id="espaço">  
<!-- Categorias principais -->
<div id="baixo">

您将在循环外部关闭它们,但是如果每个都有1个以上(例如循环迭代3次),那么循环外部的2个
标记将不会关闭所有6个打开的div标记。你要么打开你的

<div id="espaço">  
<!-- Categorias principais -->
<div id="baixo">


在循环上方,或在循环内部关闭它们。

缺少两个close div标记

//Your while loop start
<div id="espaço">  
  <div id="baixo">
     ...
  //Your code - While loop is closed
  </div>
</div>
//You must close while loop here not above.
//while循环开始
...
//您的代码While循环已关闭
//您必须在此处而非上方关闭循环。
请检查您的代码:

<?php include('cms/conectar.php');
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<style>
.prodColuna { text-align:center; width:300px; float:left; height:100%  }
</style>


<?php
$consulta = mysql_query("SELECT * FROM  `livros-desporto` ");

 if (isset($_POST['buscar'])) {
    $consulta = mysql_query("
        SELECT * FROM `livros-desporto` where name like '%".$_POST['buscar']."%'
    ");
}

while ($linha = mysql_fetch_array($consulta)) {
    $id = $linha['ID'];
    $modelo = $linha['Model'];
    $nome = $linha['Name'];
    $categoria = $linha['Category'];
    $imagem = $linha['Image'];
    $manufactura = $linha['Manufacturer'];
    $preco = $linha['Price'];
    $quantidade = $linha['quantity']
    // $adicionar = '<a href="carrinho.php?id='.$linha['ID'].'"title="'.$linha['ID'].'">
    //  Adicionar </a>'
?>
<div id="espaço">  
    <!-- Categorias principais -->
    <div id="baixo">
        <div class="prodColuna">
            <table width="200" height="300" border="1">
                <tr>
                    <th colspan="2" scope="col" height="39"><?php echo $nome ?></th>
                </tr>
                <tr>
                    <td height="35" colspan="2"><?php echo $preco ?></td>
                </tr>
                <tr>
                    <td height="184" colspan="2"><?php echo $modelo ?></td>
                </tr>
                <tr>
                    <td width="39"><?php echo $categoria ?></td>
                    <td width="145" height="30"><?php echo $id ?></td>
                </tr>
            </table>
            <br/>
        </div>
    </div>  
</div>
<?php } ?>
</body>
</html>

无标题文件
.prodColuna{文本对齐:中心;宽度:300px;浮点:左;高度:100%}

我忘记了我的css代码:获取一些工具来帮助:Firebug可以帮助揭示一个元素在哪里可能不会像你怀疑的那样关闭,并在Firefox中查看源代码,如果存在无效标记,它将指示红色标记(例如,关闭体标记)。最后,您可以查看源代码并将其复制粘贴到一个好的文本编辑器(如EditPad Pro)中,并且语法高亮显示将使您能够非常快速地查看断开的标记的位置are@user2687822最好粘贴源代码,以便我们可以看到呈现的HTML。这很可能是一个HTML问题。