View Single Post
Old 12-12-2011, 10:35 PM  
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
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

Last edited by eMonk; 12-12-2011 at 10:37 PM..
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote