Create array in while loop

Hello forums

I have this query

$q = mysql_query("SELECT cat_name FROM categories");
while($r = mysql_fetch_assoc($q)){
$ar[] = $r['cat_name'];
};

print_r($ar)

w/c gives me this:

Array
(
[0] => Air Conditioning
[1] => Appliance Installation & Repair
[2] => Architect
[3] => Attics
)

question how do i format this array so it will give me this:

Array (Air Conditioning, Appliance Installation & Repair,Architect,Attics)

Is this possible during the while loop?
Thanks

NVM it is already doing that will a mod delete this thread pleaseā€¦ sorry

thnx