Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:56:32+00:00 2026-05-31T12:56:32+00:00

Ok so i managed to figure out the php code and it is working

  • 0

Ok so i managed to figure out the php code and it is working and is outputting in the right json format when i view it in browser. Here’s the code thanks to help from Starx:

<?php
include ("Includes/dbConnect.php");

$_GET['date'];

$query2 = "SELECT * FROM events";
$checkevent = mysqli_query($cxn,$query2) or die("Couldn't execute query!");
$dates = array();
    while ($row2 = mysqli_fetch_array($checkevent))
        {
        $eventDate = $row2['eventDate'];
        $eventName = $row2['eventName'];
        $eventHost = $row2['host'];

        $dates[$eventDate] = array('title' => $eventName, 'desc' => $eventHost);

        }
    echo json_encode(array("dates" => $dates));
?>

this outputs:
{“dates”:{“2012-03-16”:{“title”:”Table Quiz”,”desc”:”MSU”},”2012-03-20″:{“title”:”Welcome”,”desc”:”Me”}}}

So there has to be a problem with my jquery code. i altered it as to Starx’s specifications but still nothing, anyone have any ideas??

    <script type="text/javascript">
    $(document).ready(function() 
 {
$("#ical").ical({ 


beforeMonth:function(date)
    {
        $.ajax({
            type: "GET",
            url: "getCalendarEvents.php",
            dataType: "json",
            data: "date="+date,
            async: false, //stop rendering the calender until eventdates is changed.
            success: json.each(function(k,v){
                $.fn.ical.changeEventDates(v); //this function changes the eventdates
            }   
        })
    }   
});
});

</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:56:34+00:00Added an answer on May 31, 2026 at 12:56 pm

    Make sure there is no futher operation after you echo the encoded json. So use an exit() at the end to confirm this

    echo json_encode($dates);
    exit;
    

    Updates

    On that case, notice that you are using two dimensional array for $date. When using $date[] = array(..) So you have to access it like

    json.each(function(k,v) { 
        //Now v will hold the json format 
        $.fn.ical.changeEventDates(v);
    });
    

    Update 2

    {“dates”:{“eventDate”:{“title”: “eventName”, “desc”: “eventHost”}, “eventDate”: {“title”: “eventName”, “desc”: “eventHost”}}}

    This format is not quite possible, since every item has same key eventDate. You can do it another way. Change up the following in the php

    echo json_encode(array("dates" => $dates));
    exit;
    

    Now , json in your success function will hold similar format

    function(json){
       // This will hold the json is this format
       // {"dates":{ 0 :{"title": "eventName", "desc": "eventHost"}, 1 : {"title": "eventName", "desc": "eventHost"}}}
       // Note the numeric indexing
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Object Oriented PHP, but have managed to figure most things out
PHP/MySQL newbie here. I managed to develop a web page that displays info from
I managed to figure out how to create a custom shape (with a dashed
Having already read this question I haven't managed to figure out what the problem
After searching through many PHP frameworks to figure out which to learn and use,
I've managed to make some single dimension array lists but I can't figure out
I'm trying to figure out how to manage my event ids. Up to this
I managed to get some help from a previous question and I have the
I managed to get the YUI calendar widget working fine. But When it displays
From managed code, how do I load a managed type from another assembly at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.