title: PHP/MySQL - Show the total # of records for each date on jquery calendar
body: <p>I'm trying to show the total number of records for a specific date on the jquery calendar like this:</p>
  
  <p><a href="https://i.stack.imgur.com/OY9dU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OY9dU.png" alt="enter image description here"></a></p>
  
  <p>For example, June 1st shows 6 on the calendar which means there's 6 records in the mysql table for June 1st</p>
  
  <p>Here's what i have</p>
  
  <p>Index.php</p>
  
  <pre><code>   &lt;div id='calendar'&gt;&lt;/div&gt;
  
  
      &lt;script&gt;
      $(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("&lt;img src='" + event.imageurl +"' width='15' height='15'&gt;");
          }
      },
  
  
  
       });
      });
  
  
      &lt;/script&gt;
  </code></pre>
  
  <p>test.php</p>
  
  <pre><code>                &lt;?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' =&gt; $title,
                                  'url' =&gt; 'myfeed.php?dt='.substr($date, 0, 10),
                                  'start' =&gt; substr($date, 0, 10)
                              );
                          }
                          echo json_encode($arr);
                      }
                  }
  
                      ?&gt;
  </code></pre>