<?php $query = "select * from ".$prefix."store_inventory where cat_id='$cat_id' AND p_akt='1' order by popularity desc LIMIT 5"; if($count_t==0){ $sql_select_k = mysql_query( "SELECT * FROM ".$prefix."store_category where cat_father_id = '$cat_id' order by rand() desc LIMIT 1"); { $query = "select * from ".$prefix."store_inventory where cat_id='$cat_id' AND p_akt='1' order by popularity desc LIMIT 5"; } } ?>
np łącząc ze ma wybrać z najpierw kategorie a potem z niej produkty