我正在尝试显示引号,但我似乎无法使数据显示在索引页面上,我仍然是php和mysql的新手,这是一条路过的路
html索引页面
<div class="quote">
<div class="container">
<blockquote class="blockquote">
<p class="mb-0">"<?php echo $row['feedback']; ?>"</p>
<footer class="blockquote-footer"><?php echo $row['companyname']; ?></footer>
</blockquote>
<blockquote class="blockquote-reverse">
<p class="mb-0">"<?php echo $row['feedback']; ?>"</p>
<footer class="blockquote-footer"><?php echo $row['companyname']; ?></footer>
</blockquote>
<blockquote class="blockquote">
<p class="mb-0">"<?php echo $row['feedback']; ?>"</p>
<footer class="blockquote-footer"><?php echo $row['companyname']; ?></footer>
</blockquote>
</div>
</div>
与数据库连接
<?php
$hostname = "";
$username = "";
$password = "";
$db = "";
$dbconnect=mysqli_connect($hostname,$username,$password,$db);
if ($dbconnect->connect_error) {
die("Database connection failed: " . $dbconnect->connect_error);
}
$query="SELECT companyname,feedback,status from review WHERE status=? ORDER BY RAND() LIMIT 3";
?>
答案 0 :(得分:0)
<?php
$hostname = "";
$username = "";
$password = "";
$db = "";
$dbconnect=mysqli_connect($hostname,$username,$password,$db);
if ($dbconnect->connect_error) {
die("Database connection failed: " . $dbconnect->connect_error);
}
$query=mysqli_query($dbconnect,"SELECT companyname,feedback,status from review WHERE status=? ORDER BY RAND() LIMIT 3");
$row = mysqli_fetch_assoc($query);
?>