query($total_sql);
$total_row = $total_result->fetch_assoc();
$total_items = $total_row['total'];
// 计算总页数
$total_pages = ceil($total_items / $items_per_page);
// 查询数据,先显示 statuss = 'No',再显示 statuss = 'Yes'
$sql = "SELECT id, urls, titles, logos, keywordss, descriptions, countrys, categoryss, statuss
FROM url_entries
ORDER BY
CASE WHEN statuss = 'No' THEN 1 ELSE 2 END ASC,
id DESC
LIMIT $offset, $items_per_page";
$result = $conn->query($sql);
// 检查是否有数据
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$id = $row['id'];
$urls = $row['urls'];
$titles = strlen($row['titles']) > 20 ? substr($row['titles'], 0, 20) . '...' : $row['titles'];
$logos = $row['logos'];
$keywordss = strlen($row['keywordss']) > 100 ? substr($row['keywordss'], 0, 100) . '...' : $row['keywordss'];
$descriptions = strlen($row['descriptions']) > 100 ? substr($row['descriptions'], 0, 100) . '...' : $row['descriptions'];
$countrys = $row['countrys'];
$categoryss = $row['categoryss'];
$statuss = $row['statuss']; // 获取 statuss 字段
echo "
No data found.
Showing = (($page - 1) * $items_per_page + 1) ?>
to = min($page * $items_per_page, $total_items) ?>
of = $total_items ?>