$query_where = array();
if($param1) $query_where[] = "activities.name_activity = '$param1'";
if($param2) $query_where[] = "customers.name_customer = '$param2'";
if($paramN) $query_where[] = "paramN = `$paramN`";
$query_where = implode(' AND ', $query_where);
$result = mysql_query("SELECT ... WHERE $query_where ORDER BY id_order desc LIMIT $limit;") or die(mysql_error());