I am creating a table that echo out replied messages and not replied messages.
My script for not replied messages worked well,only those not replied appeared. But my other script for replied messages echo all data, both replied and not replied.
my script in one page,
<div class="container">
<div class="row">
<?php
require_once 'dbfunction.php';
$con = getDbConnect();
if (!mysqli_connect_errno($con)) {
$sqlQueryStr = "SELECT * FROM feedback WHERE status = 0";
$result = mysqli_query($con, $sqlQueryStr);
while ($row = mysqli_fetch_array($result)) { // fetch the record
$feedback[$row['record']] = $row;
}
mysqli_close($con);
} else {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
<div class="container">
<h2>Customer Feedback - await for reply</h2>
<table class="table table-hover">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Relpy</th>
</tr>
</thead>
<?php
foreach ($feedback as $id => $info) {
echo '<tbody>';
echo '<tr>';
echo '<td>' . $info['name'] . '</td>';
echo '<td>' . $info['email'] . '</td>';
echo '<td>' . $info['message'] . '</td>';
echo '<td><button class="btn btn-info">' . 'Reply' . '</button></td>';
echo '</tr>';
echo '</tbody>';
}
?>
</table>
</div>
</div>
</div>
<div class="container">
<div class="row">
<?php
require_once 'dbfunction.php';
$con = getDbConnect();
if (!mysqli_connect_errno($con)) {
$sqlQueryStr = "SELECT * FROM feedback WHERE status != 0";
$result = mysqli_query($con, $sqlQueryStr);
while ($row = mysqli_fetch_array($result)) { // fetch the record
$feedback[$row['record']] = $row;
}
mysqli_close($con);
} else {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
<div class="container">
<h2>Customer Feedback - Replied</h2>
<table class="table table-hover">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Relpy</th>
</tr>
</thead>
<?php
foreach ($feedback as $id => $info) {
echo '<tbody>';
echo '<tr>';
echo '<td>' . $info['name'] . '</td>';
echo '<td>' . $info['email'] . '</td>';
echo '<td>' . $info['message'] . '</td>';
echo '<td>' . 'Replied' . '</td>';
echo '</tr>';
echo '</tbody>';
}
?>
</table>
</div>
</div>
</div>
How can i change it?
</div>