Off Topic:
You can put multiple items together in
switch, so instead of having "high" and "default" with the same action, you can just do
PHP Code:
switch($choice) {
case 'low':
$sql = "SELECT * FROM product_table where dealer_id=$dealer_id order by price asc";
break;
case 'medium':
$sql = "SELECT * FROM product_table where dealer_id=$dealer_id and catg = 'medium'";
break;
case 'high':
default :
$sql = "SELECT * FROM product_table where dealer_id=$dealer_id order by price desc";
break;
}
Anyway, I think I'd use this
PHP Code:
$extra = array(
'low' => 'order by price asc',
'medium' => 'and catg = "medium"',
'high' => 'order by price desc'
);
$sql = 'SELECT * FROM product_table where dealer_id='.intval($dealer_id) . ( isset($extra[$choice])? (' '.$extra['choice']) : '' );
$result=mysql_query($sql);
while($row = mysql_fetch_array($result))
{
// results will be displayed here which is approx 50 lines code.
}
But that's just because I don't like switch (too easy to forget a break leaving you debugging for hours on end because you don't spot the omission ...), and like arrays 
As you can see, I don't like double quotes either
Bookmarks