Hi...
Im have a code that querys a mysql database against a certain criteria, and returns a result. The result then, is displayed in table rows inside a while loop, using the 'mysql_fetch_array' function:
while($row = mysql_fetch_array($qry_result)){
By the way, this is a classifieds website... Here is my problem:
After the results are displayed, I want the user to be able to click a button or link and then filter the results in 3 ways ('ALL ADS', 'ONLY PRIVATE ADS' or 'ONLY COMPANY ADS'). Is there a smart way to do this without ten pages of code?
I already have a solution, that is to add an if statement before the while loop, to check if a variable is 1, 2 or 3, and then have three while loops:
if ($ads_shown=='1'){ while loop and show "ALL ADS"}
else if ($ads_shown=='2'){while loop and show "PRIVATE ADS"}
else if ($ads_shown=='3'){while loop and show "COMPANY ADS"}
but this doesn't seem like the best way if I am seeking maximum speed in this case! So, any help?