Hi, I am attempting to load data from a mySQL database and bind it to the correct date in the calendar.
I have managed to do this but when it binds to the corrrect date it then loops to the last date of the month and then starts again so I end up with the calendar duplicated.
To see what I mean see http://www.myliverpoolnetworking.co.uk/calendar2.php
This is the source code for the page:
[php]<?php
$config = “something.php”;
require($config);
//set database connection
$conn = @mysql_connect($DBIP,$DBUSER,$DBPASS) or die(“Err:Conn”);
@mysql_select_db($DBNAME,$conn) or die(“Err:Db”);
$sql = “select * from “.$DBTABLENAME.” order by eventDate”;
$rs = mysql_query($sql,$conn);
$dates = mysql_query($sql,$conn);
date_default_timezone_set(‘UK/London’);
$numDaysMonth = date(‘t’);
$month = date(‘m’);
$todayDay = date(‘Y-m-d’);
$firstDay = date(“Y”)."-". date(“m”) ."-" . “01” ;
$lastDay = date(“Y”)."-". date(“m”) ."-" . “$numDaysMonth” ;
?>
ID | Event Name | Date |
<?=$row["id"]?> | <?=$row["eventName"]?> | <?=$row["eventDate"]?> |
<?php for($dayHolder = $firstDay; $dayHolder <= $lastDay; $dayHolder++) { if ($dayHolder == $todayDay) { print "" ; print "Name Of Event"; print "
"; print ($todayDay); print ""; print "
"; } else { print ($dayHolder); print "
"; } } ?>[/php]
Any ideas?