...

View Full Version : Adding PHP&MySQL support to jQuery iCal



prole
01-05-2011, 10:24 PM
Hello friends, I'm new at this place and I hope that you can help me. I need to make simple calendar which will show events in popup bubble from database. Searching internet I found this: https://github.com/MrHus/jquery-monthly-ical/tree/ It's based on Stefano Verna's iCal http://www.stefanoverna.com/wp-content/tutorials/ical_like_calendar/ but it's added a lot of funcionality.

Original index.html looks like this:


<body>
<script type="text/javascript">
$(document).ready(function()
{
$("#ical").ical({
eventdates: [
{"date": "2009-03-21", "title": "My birthday", "desc": "Its my birthday!"},
{"date": "yyyy-01-01", "title": "New Year", "desc": "Its a new year!"},
{"date": "2010-mm-01", "title": "Towl", "desc": "Dont forget to bring a towl."} });
});
</script>
<div id="ical"></div>
</body>

I modified this to index.php


<body>
<?php
$sql_query = mysql_query("SELECT * FROM events", $connect);
while ($show_row = mysql_fetch_array($sql_query)):
$show_Date = $show_row['date'];
$show_Title = $show_row['title'];
$show_Description = $show_row['description'];
?>
<script type="text/javascript">
$(document).ready(function()
{
$("#ical").ical({
eventdates: [{"date": "<?php echo ("$show_Date"); ?>", "title": "<?php echo ("$show_Title"); ?>", "desc": "<?php echo ("$show_Description"); ?>"}]
});
});
</script>
<div id="ical"></div>
<?php
endwhile;
?>
</body>

I works but it's shown only last event that I added into database. I'm not sure where is the problem.
Thanks,
prole



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum