0

我正在尝试在我的产品页面中添加一些“无限滚动”。但是,我根本无法让它工作,所以我什么都没有。该页面当前有效,但它只输出所有产品。我无法获得我发现工作的无限滚动脚本,因为我的查询并不总是相同的。

这是使用 GET 构建我的查询的代码:

$kategori_q = "";
if ($kategori !== "") {
    if ($hkat !== "") {
        $ukator = "";
        $underkategorier = sqlSelect("SELECT * FROM underkategorier WHERE fk_hkategori = '$kategori'");
        while ($row = sqlFetch($underkategorier)) {
            $ukator .= " fk_ukategori = '".$row['underkategori_id']."' OR"; 
        }
        $kategori_q = rtrim($ukator, "OR");
        $kategori_q = "WHERE ($kategori_q)";
    }
    else {
        $kategori_q = "WHERE fk_ukategori = '$kategori'";
    }
}

$query = "SELECT * FROM annoncer $kategori_q ORDER BY annonce_id DESC";

$soeg = "";
if (isset($_GET['soeg'])) {
    $soeg = $_GET['soeg'];
    if (substr_count($query, "WHERE") == 1) {
        $soeg = " AND (overskrift LIKE '%$soeg%' OR beskrivelse LIKE '%$soeg%')";
    }
    else {
        $soeg = " WHERE (overskrift LIKE '%$soeg%' OR beskrivelse LIKE '%$soeg%')";
    }
}

$query = "SELECT * FROM annoncer $kategori_q $soeg ORDER BY annonce_id DESC";
$q = sqlSelect($query);
4

0 回答 0