I've never used list() in such a manner, so I don't know for sure if it would work, but I have my doubts, try the following:
PHP Code:
$query ="Select cl_category_id FROM cl_categories";
$result = mysql_query($query);
while ($cat = mysql_fetch_array($result, MYSQL_NUM)) {
echo $cat['cl_category_id'];
}
and see if that works for you.
note that instead of $type you use $cat['cl_category_id'] - I would recommend always doing mysql queries like this as if you were to change something in your database you wouldn't have to adjust all of your php code
Also try debugging, start with a single while loop for the categories and see if it prints out all the rows, then insert the other while loop inside and see if they work together nicely.