If you want a specific ID you have to tell that in the query - the ID may be from direct input, from a variable or from a function like rand() or a subquery.
am just trying to display rand row with same cat_id
i tried this
$query = "SELECT * FROM " . $DBPrefix . "auctions
WHERE category IN (SELECT cat_id FROM " . $DBPrefix . "categories
WHERE category = category AND cat_id = cat_id ) ORDER BY RAND() LIMIT 3";
but still showing random selection of different id
You are still just connecting the records by anycat_id, but you are not actually reducing the records to a specificcat_id. Just have a look at what your query results without the limit. Use a cat_id that is determined by a fixed value, a variable, a function or a subquery.
HI thanks for the reply, i did that i believe this way
// get music catergory random
$query = "SELECT * FROM " . $DBPrefix . "auctions
WHERE category IN (SELECT cat_id FROM " . $DBPrefix . "categories
WHERE cat_id = " . $id . " ) ORDER BY RAND() LIMIT 3";
HI thanks for the reply, i did that i believe this way
// get music catergory random
$query = "SELECT * FROM " . $DBPrefix . "auctions
WHERE category IN (SELECT cat_id FROM " . $DBPrefix . "categories
WHERE cat_id = " . $id . " ) ORDER BY RAND() LIMIT 3";
no idea what am suppose to do there
this is what am simply trying to accomplish
on every random it shows different value with same id
genre title
208 gospel jesus lives
208 gospel jesus wonderful
208 gospel love is love
when i refresh page shows another
genre title
211 rap hard lives
211 rap wonderful
211 rap love rare
211 rap bad girl
when i refresh page shows another
genre title
231 hippop lives
231 hippop fright
You had six days to make a minimal example that takes ten minutes (because its just a copy of the data you already have), so that potential helpers dont have to do all the work for you - and you dont even come up with new insights? There is a simple way, you already got necessary answers, all you have to do is to put more effort in finding a solution and to give the people around you a starting point.