gpt4 book ai didi

php - 我想要
并想在行和 3 列中设置我的
( block )所以请检查我的代码

转载 作者:太空宇宙 更新时间:2023-11-04 10:15:03 25 4
gpt4 key购买 nike

我的代码在下面,我想在我的页面上创建一个动态框类型结构,该结构有 3 行和 3 列,但结果只显示一列和多行(我是编程新手):

  <!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="style1.css">
</head>
<body>

<?php

include("connect.php");
$query="SELECT * FROM `orders`";
$filter_Result=mysqli_query($con,$query);
while($row = mysqli_fetch_array($filter_Result)){
echo "<div class='row'>";
echo "<div class='block'>";
echo "<div class='boxed'>";

echo "<div id='container'>";


echo "<td>" . $row['id'] . "</td>" ."<br>";
echo "<td>" . $row['status'] . "</td>"."<br>";
echo "<td>" . $row['created_date'] . "</td>"."<br>";
echo "<td>" . $row['uid'] . "</td>"."<br>";

echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";


}
?>
</body>
</html>

css文件是:

   .boxed {
border: 1px solid green ;
width: 80px;
height: 80px;
padding: 25px;
border: 5px solid #000000;
margin: 25px;
color: #FF9900;
background-color: #000000;
align:center;
}
#container {
width:100%;
text-align:center;
}

#left {
float:left;
width:100px;
}

#center {
display: inline-block;
margin:0 auto;
width:100px;
}

#right {
float:right;
width:100px;
}
.row {
width: 100%;
margin: 0 auto;
}

.block {
width: 100px;
display: inline-block;
}

输出:

最佳答案

您缺少 <table><tr>标签。请将其添加到您的代码中。使用以下代码。

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="style1.css">
</head>
<body>

<?php

include("connect.php");
$query="SELECT * FROM `orders`";
$filter_Result=mysqli_query($con,$query);
while($row = mysqli_fetch_array($filter_Result)){
echo "<div class='row'>";
echo "<div class='block'>";
echo "<div class='boxed'>";

echo "<div id='container'>";

echo "<table><tr>";
echo "<td>" . $row['id'] . "</td>" ."<br>";
echo "<td>" . $row['status'] . "</td>"."<br>";
echo "<td>" . $row['created_date'] . "</td>"."<br>";
echo "<td>" . $row['uid'] . "</td>"."<br>";
echo "</table></tr>";

echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";


}
?>
</body>
</html>

关于php - 我想要 <div> 并想在行和 3 列中设置我的 <div> ( block )所以请检查我的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37317631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com