Apart from the requisite mention that you shouldn't use "mysql_" functions, you have (at least) one logic error in your code.
The while
loop:
while($rs = mysql_fetch_array($q))
{
$events = $rs['cal_event'];
$event_day = date("j", strtotime($rs['cal_date']));
}
Is looping through all the results, but not doing anything with them. So, the variables $events
and $event_day
is getting set to the last values encountered. You should probably do something in this loop.