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 8542141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:59:23+00:00 2026-06-11T11:59:23+00:00

this is my first post, so be gentle :) I am brand new to

  • 0

this is my first post, so be gentle 🙂

I am brand new to PHP, MySQL, and JQUERY, but I have a lot of experience programming with AS3, Java, and C++, so I have some frame of reference to how some of this stuff works…

Here’s what I’m trying to do:

  • I am creating a website for my church and using the Fullcalendar class for our scheduler
  • Note: Google Calendar is not an option
  • I need to be able to set recurring events, and color each event based on whether or not it has been canceled

Here’s how far I’ve gotten:

  • I have a MySQL database with 8 fields: p_id (for my use only), id, title, start, end, allDay, url, canceled
  • I have a PHP file with the following code:

.

//--------------------------------------------------------------------------
// Example php script for fetching data from mysql database
//--------------------------------------------------------------------------
$host = "fakehost";
$user = "fakeuser";
$pass = "fakepwd";

$databaseName = "fake_db";
$tableName = "tbl_calendar";

//--------------------------------------------------------------------------
// 1) Connect to mysql database
//--------------------------------------------------------------------------
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);

//--------------------------------------------------------------------------
// 2) Query database for data
//--------------------------------------------------------------------------
$query = "SELECT id,title,start, DATE_FORMAT(start, '%Y-%m-%d %H:%i' ) AS startDate, end, url FROM $tableName ORDER BY startDate DESC";
$result = mysql_query($query) or die(mysql_error());

$array = array();
while($row = mysql_fetch_assoc($result)){
$array[] = $row; 
}  

//--------------------------------------------------------------------------
// 3) echo result as json 
//--------------------------------------------------------------------------
echo json_encode($array);

?>
  • I also have the following code in my HTML file:

    <script type='text/javascript'>
    
    $(document).ready(function() {
    
    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        editable: false,
    
        allDayDefault: false,
    
        url: true,
    
        timeFormat: 'h(:mm)t', // uppercase H for 24-hour clock
        agenda: 'h(:mm)t' , // 5:00 - 6:30
        '': 'h(:mm)t', // for all other views
    
        events: "../data/get_calendar.php",
        eventDrop: function(event, delta) {
            alert(event.title + ' ha sido movido ' + delta + ' dias\n' + '(should probably update your database)');
    
        },
    
        loading: function(bool) {
            if (bool) $('#loading').show();
            else $('#loading').hide();
        },
    
        eventClick: function(calEvent, jsEvent, view) {
    
             //alert('Event: ' + calEvent.title);
             //alert('Url: ' + calEvent.url);
             //alert('View: ' + view.name);
    
             window.open(calEvent.url, blank);
             return false;
    
        }
    
    });
    
    
    });
    

It all works great as far as using the events I have in the database and placing them on the calendar where they belong.

The problem is that I’m trying to add specific CSS classes to each event. I would like canceled events to be Red, for example (versus deleting them).

I have looked through a lot of material. Read a lot about event sources and I just don’t get it… I can’t make it work. Ideally, I’d like to add another field to my database and just have it apply a class name or color automatically. I can apply colors through hard code, but I just don’t understand how to do it through the database.

Can anyone help? Please give me a lot of simple steps, because apparently, I’m not that smart :-S

EDIT:
I have tried to add a field called “className” and I’ve written corresponding CSS rules. I thought that would do it, but when I inspect the element, I don’t see the className anywhere… I don’t think it’s applying it automatically from the MySQL database. I also tried Brotherli’s suggestion below, but can’t get that to work either (probably user error). Perhaps I need to change some of my fullcalendar jquery code?

  • 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-06-11T11:59:24+00:00Added an answer on June 11, 2026 at 11:59 am

    You can define CSS classes on a per-event basis. See attribute ‘className’ in http://arshaw.com/fullcalendar/docs/event_data/Event_Object/

    Change your PHP code to something like

    while($row = mysql_fetch_assoc($result)){
        if ($row['deleted'])
            $row['className'][] = 'deleted';
        if ($row['canceled'])
            $row['className'][] = 'canceled';
        $array[] = $row; 
    }
    

    Alternatively you can also add CSS classes on the client using the eventRender callback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first post and I my first experience with jquery. I have
this is my first post here. I'm new in Android Programming. I want to
This is my first post on StackOverflow, so please be gentle... I have some
this is my first post on this great source of programming information. I have
This is my first post, I'm new to this site, but I've been lurking
this if my first post so please be gentle. I have an iOS 5
This is my first post, thx, you've been very helpful. But I'm stuck. I
This is my first post here. I have a problem. I need to take
this is my first post on this website, but I'm all the time getting
This is my first post, so please be gentle. I've been playing around with

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.