这是网格的模板,但它不是静态数据库所以我不知道循环是否会起作用,如果它不知道如何使用它
<div class="container">
<div class="row-fluid">
<ul class="thumbnails">
<li class="span3">
<div class="thumbnail" style="padding: 0">
<div style="padding:4px">
<img alt="300x200" style="width: 100%" src="http://placehold.it/200x150">
</div>
<div class="caption">
<h2>Fadahunsi Simeon</h2>
<p>My project description</p>
<p><i class="icon icon-map-marker"></i> Place, Country</p>
</div>
<div class="modal-footer" style="text-align: left">
<div class="progress" style="background: #ddd">
<div class="bar bar-danger" style="width: 30%;"></div>
</div>
<div class="row-fluid">
<div class="span4"><b>60%</b><br/><small>FUNDED</small></div>
<div class="span4"><b>$1000</b><br/><small>PLEDGED</small></div>
<div class="span4"><b>NOT FUNDED</b><br/><small></small></div>
</div>
</div>
</div>
</li>
</ul>
</div>
答案 0 :(得分:0)
您可以在php中使用循环来创建这些容器,以便显示详细信息。
示例代码:
$row = mysqli_fetch_array($result)
while($row){
echo $row['name']. " - ". $row['age'];
echo "<br />";
}
以这种方式循环并创建这些容器。
样品MYSQL&amp; PHP连接代码:
<?php
if(isset($_POST['formSubmit'])){
$DB_USER="root";
$DB_PASS="";
$DB_HOST="localhost";
$DB_NAME="contacts";
$conn = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$name = $_POST['formName'];
$title = $_POST['formTitle'];
$enquiry = $_POST['formEnquiry'];
$sql = "INSERT INTO enquiries (Name, Title, enquiry) VALUES('".$name."', '".$title."', '".$enquiry."')";
$result = $conn->query($sql);
if($result){
alert("Thank You");
}else{
alert("error!");
}
mysqli_close($conn);
}
?>