当我尝试订购我希望他们每张桌子订购的桌子时。但是现在当我订购 de tables 时,两个表都已订购。我该如何解决这个问题?
这是我的代码。这两个表都是一样的。
<h2>Series</h2>
<table class="styled-table">
<?php
// this is filtering series
// set array with values to find
$checkSeries = array('title', 'rating');
// Only get the columnSeries if it exists in the above checkSeries array, if it doesn't exist the database table will be sorted by the first item in the checkSeries array.
$columnSeries = isset($_GET['columnSeries']) && in_array($_GET['columnSeries'], $checkSeries) ? $_GET['columnSeries'] : $checkSeries[0];
// Get the sort orderMovies for the columnSeries, ascending or descending, default is ascending.
$sort_order_series = isset($_GET['orderSeries']) && strtolower($_GET['orderSeries']) == 'desc' ? 'DESC' : 'ASC';
// Get the result...
$dataSeries = $conn->query('SELECT * FROM series ORDER BY ' . $columnSeries . ' ' . $sort_order_series);
if (!empty($dataSeries)) {
// Some variables we need for the table.
$up_or_down_series = str_replace(array('ASC','DESC'), array('up','down'), $sort_order_series);
$asc_or_desc_series = $sort_order_series == 'ASC' ? 'desc' : 'asc';
}
?>
<thead>
<tr>
<th>
<a href="index.php?columnSeries=title&orderSeries=<?php echo $asc_or_desc_series; ?>">Title
<i class="fas fa-sort<?php echo $columnSeries == 'title' ? '-' . $up_or_down_series : ''; ?>"></i>
</a>
</th>
<th>
<a href="index.php?columnSeries=rating&orderSeries=<?php echo $asc_or_desc_series; ?>">Rating
<i class="fas fa-sort<?php echo $columnSeries == 'rating' ? '-' . $up_or_down_series : ''; ?>"></i>
</a>
</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php
// get data using for each
foreach ($dataSeries as $row) {
$str = http_build_query($row);
echo "<tr>";
echo "<td> {$row['title']} </td>";
echo "<td> {$row['rating']} </td>";
echo "<td> <a href='detail_serie.php?$str'>Bekijk Details</a> </td>";
echo "</tr>";
}
?>
</tbody>
</table>`
我试过为每个表命名变量,但表仍然是一起排序的。