I'm trying to show the total number of records for a specific date on the jquery calendar like this:
For example, June 1st shows 6 on the calendar which means there's 6 records in the mysql table for June 1st
Here's what i have
Index.php
<div id='calendar'></div>
<script>
$(function() { // document ready
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: false,
events: 'test.php',
eventSources: [
// your event source
{
events: [ // put the array in the `events` property
{
title : 'Happy Thanksgiving',
start : '2016-11-25',
end : '2016-11-25',
imageurl:'img/holiday-icon.png'
},
],
color: 'transparent', // an option!
textColor: 'black' // an option!
}
// any other event sources...
],
eventRender: function(event, eventElement) {
if (event.imageurl) {
eventElement.find("div.fc-content").prepend("<img src='" + event.imageurl +"' width='15' height='15'>");
}
},
});
});
</script>
test.php
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$username = "root_jdc";
$password = "password";
$hostname = "localhost";
$database = "table_customers";
$conn = mysql_connect($hostname, $username, $password)
or die("Connecting to MySQL failed");
mysql_close($conn);
if ($conn) {
if (isset($_GET["end"])) {
//this is calendar query.
//form an array of events
$arr = array();
$from_date = htmlspecialchars($_GET["end"]);
$to_date = htmlspecialchars($_GET["end"]);
$sql_string = "SELECT count(DISTINCT id) as title, date as ShipDate FROM players3 group by date";
$result = mysql_fetch_assoc($sql_string);
//odbc_result_all($result);
// Fetch rows:
while(mysql_fetch_array($result))
{
if (!mysql_result($result,2)) continue;
//collect results
$title=mysql_result($result,1);
$date=mysql_result($result,2);
$arr[] = array(
'title' => $title,
'url' => 'myfeed.php?dt='.substr($date, 0, 10),
'start' => substr($date, 0, 10)
);
}
echo json_encode($arr);
}
}
?>