Using Database Information to Change CSS/Appearance of Text

Disclaimer: I'm new to web development.

Goal: I'm creating an event calendar, and there will be status for each event: completed; not completed; and completed late. If an event is completed, I want it to be highlighted green. If an event is not completed, I want it to be highlighted red. If it's completed late, I want it to be highlighted yellow.

Note: With this in mind, I already have everything set up that needs to be in place so far up to this point (database, etc.).

Question: I'm wanting to know how I can use my current platforms (HTML/CSS/CodeIgniter/PHP/JS), to access the event condition (completed, not completed, completed late) from the database (MySQL) to highlight (or change the background color of) the event shown in the calendar. I'm wondering what resources I could look into making this possible, and complete solutions are also welcome. I will be more than happy to provide any other information omitted from this post. Thank you so much for all of your help!

Answers


I think it's a quite easy problem ; you just need to assign each status a code ("completed", "not_completed", "completed_late") that you'll put in your database. Probably you've already done that. Then, when you display your events, just add this code as a class ; for exemple :

<div class="event <?php $event->getStatus() ?>">
    ...
</div>

You just have to define the correct style for status class. ;)


Need Your Help

Initial SessionFactory creation failed.javax.persistence.PersistenceException

java jsp jpa eclipselink

I am doing web application.I found many questions with same problem

Display image in QTreeView

c++ qt treeview

I'm trying to show an image in a QTreeView together with some other data. To to this I've created an QAbstractItemModel. In the data method, I return some strings for column index 0 and 1 and for the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.