I'm not sure why it isn't working as you want but why not create an array with the month names, and then use the value from the DB as an index?
i.e.
<?php
$monthtxt = array ('1' => 'January','February','March','April','May','June','July','August','September','October','November','December');
$sql = "SELECT day,month,year FROM availability";
$result=db_query($sql);
while($row=mysql_fetch_array($result)){
$day = $row['day'];
$month = $row['month'];
$year = $row['year'];
echo $day, $monthtxt[$month], $year;
}
Try that, it should work.