The mysql DB has a table with 2 columns as Name and values. and i want that to display values from min to max except but if some name has value zero, i want to skips that value.
Since you're storing multiple names in one field and then the corresponding values in another field you should move your logic to PHP.
When you are looping through your result set, for each row:
//create arrays of the comma separated fields
$keys = explode(",", $row['name']);
$values = explode (",", $row['value']);
//combine them & flip since you want to use the values as keys and the keys as values
$combined = array_combine($values, $keys);
//sort by value (which has become a key)
ksort($combined);
// you should now have an array looking like:
// array(0 => "d", 1 => "c", 2 => "b", 5 => "a");
// now let's remove the 0 value
unset($combined[0]);
//debug to make sure this is what you want
print_r($combined);