I just changed $strqry and $data_p and now when I click on page 2 it's showing 0 results.
old queries:
Code:
$strqry = "SELECT id from model WHERE status = 'Active' ";
$data_p = "SELECT * FROM model WHERE status = 'Active' ORDER BY RAND($rand) $max";
new queries:
Code:
$strqry = "SELECT DISTINCT model.id from model
INNER JOIN model_in_city ON (model_in_city.model_id = model.id)
INNER JOIN city ON (city.city_id = model_in_city.city_id)
INNER JOIN province on (city.province_id = province.id)
WHERE province.name = '$region'
AND model.status = 'Active' ";
$data_p = "SELECT DISTINCT(model.id), model.thumbnail, model.name, model.location FROM model
INNER JOIN model_in_city ON (model_in_city.model_id = model.id)
INNER JOIN city ON (city.city_id = model_in_city.city_id)
INNER JOIN province on (city.province_id = province.id)
WHERE province.name = '$region'
AND model.status = 'Active'
ORDER BY RAND($rand) $max";
It's showing 5 results out of 6 results like it should on the first page but when I click on page 2 it displays 0 results. Any ideas why?
Post #8 has the complete code:
https://gfy.com/showpost.php?p=18519612&postcount=8