$result = mysql_query("SELECT * FROM Pax ORDER BY Habitaciones_ID ASC"); $indice = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $arreglo[] = $row[Costo]; } $todojunto = implode(',',$arreglo);