PHP Calendar Help

Hey guys

I have a php calendar on my site. What i would like is to connect to a mysql database and if the value of the ‘Day’ column matches the day number i want it to have a red background.

this is the code i have

<?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; ob_start(); $con = mysql_connect("localhost","thebeach","4sSq99Jht0"); $day = mysql_query ("SELECT Day FROM calendar"); for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ) echo "\n"; if($i < $startday) echo "\n"; else echo "". ($i - $startday + 1) . "\n"; if ($day = ($i - $startday + 1)) echo "". ($i - $startday + 1) ."\n"; if(($i % 7) == 6 ) echo "\n"; } ob_end_flush(); ?>

This isnt working though could ayone help me out plz.

thanks

Hi

Try this

<?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; ob_start(); $con = mysql_connect("localhost","thebeach","4sSq99Jht0"); $day = mysql_query ("SELECT Day FROM calendar"); for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ) echo "\n"; if($i < $startday) echo "\n"; else echo "". ($i - $startday + 1) . "\n"; if ($day == ($i - $startday + 1)) echo "". ($i - $startday + 1) ."\n"; if(($i % 7) == 6 ) echo "\n"; } ob_end_flush(); ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service