php - Best way to show number of results in a filter using Ajax -
first, quick explanation of current situation:
my webpage contains list of (about 40, categorized) filters , list of 400+ products.
i list of products using ajax. default 20 products shown, when scroll bottom more products added. users can filter results clicking desired option. it's simplified ebay. difference don't reload page when click on filter, instead use ajax products.
now, ebay has these numbers next every filter option, shows amount of results you'd if click option. question is, what best way show these numbers?
my approach run sql query (select count(id) sometable filter='something'
) every filter option. means have run 40 queries on load, , every time user clicks option (using ajax). seems heavy server load, or wrong?
i'm going first approach, i'm using union
queries counts. way have run 1 query instead of 1 query every filter.
Comments
Post a Comment