O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a CodeIgniter Calendar helper with database results

CodeIgniter comes with a really useful calendar helper that allows you to display months in a grid. It is possible to develop functionality to pull events from a database (such as a table that stores diary appointments) and indicate to the user if there is an appointment on a given day.

Getting ready

As we're storing appointments in a database, we'll need a database table. Copy the following code into your database:

CREATE TABLE `appointments` ( `app_id` int(11) NOT NULL AUTO_INCREMENT, `app_date` varchar(11) NOT NULL, `app_url` varchar(255) NOT NULL, `app_name` varchar(255) NOT NULL, PRIMARY KEY (`app_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; INSERT INTO `appointments` ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required