query($total_sql);
$total_row = $total_result->fetch_assoc();
$total_items = $total_row['total'];
// 计算总页数
$total_pages = ceil($total_items / $items_per_page);
// 查询当前页数据
$sql = "SELECT urls, titles, logos, keywordss, descriptions, countrys, categoryss, statuss
FROM url_entries
WHERE statuss = 'Yes'
ORDER BY id DESC
LIMIT $offset, $items_per_page";
$result = $conn->query($sql);
// 检查是否有结果
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
// 处理数据字段长度限制
$urls = $row['urls'];
$titles = strlen($row['titles']) > 30 ? substr($row['titles'], 0, 30) . '...' : $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'];
// 动态生成 HTML
echo "
No data found.
Showing = (($page - 1) * $items_per_page + 1) ?>
to = min($page * $items_per_page, $total_items) ?>
of = $total_items ?>