Hi guys.
I’m using this calendar
http://www.ldida.altervista.org/calendario/index2.html for a project of mine.
This calendar has this really simple file data.js
[code]var codropsEvents = {
'12-31-2016' : '<span>New Year\'s Eve</span>'
};[/code]
to send the date and events to the calendar.
I’ve made a form , a db and i’ve let a guest to insert events into the database.
Now i want to retrive the data from the database and the name of the event and to put those into the data.js so the calandar can show the event from the database.
To retrive the data from the database i use data.php
[php]<?php include ‘config.php’;
$sql = “SELECT str_data , occasione FROM Evento”;
$result = mysql_query($sql) or die (mysql_error());
if(mysql_num_rows($result) > 0)
{
while($fetch = mysql_fetch_array($result))
{
$data = date(“m-d-Y”, $fetch[‘str_data’]);
$occasione =($fetch[‘occasione’]);
echo "$data $occasione
";
} }
?>[/php]
The code works because the echo gives me the date form the DB in the form i want. Now, how i can pass those data to the data.js file?