Dinamik navigasyon için garip sorgusu sonuçları

0 Cevap php

Sorduktan sonra benim last question ben sorun çözüldü düşündüm ve sağlanan cevabı ben bunu denedim çalışıyordu.

Sorun şu anda product_id + o başarısız 100 kadar navigasyon veritabanında önceki ve sonraki satır seçer olduğunu.

İşte bağlantılar oluşturmak için kullanıyorum kodu:

$prevProduct = $prod - 3;
$queryNextProductID = 'SELECT product_id FROM products WHERE product_id > '.$prod.' AND   category='.$cat.' LIMIT 1';
$queryPrevProductID = 'SELECT product_id FROM products WHERE product_id < '.$prod.' AND   category='.$cat.' LIMIT '.$prevProduct.',1';

$queryPrevProductID, boş bir sonuç kümesi döndürür 100 + kadar tablosunda önceki satır döndürür.

Buyrun bu benim tablonun basitleştirilmiş versiyonu daha iyi konuyu açıklamak için:

product_id
1
3
5
80
103
104

On the page of product_id=3 the Previous link will be 1 and the Next link will be 5
On the page of product_id=80 the Previous link will be 5 and the Next link will be 103
On the page of product_id=103 the Previous link will not be there, and the Next link will be 104

Sorunun herhangi bir fikir?

0 Cevap