Using an HTML table with DataTable and a database

CodeIgniter comes with a useful library to handle HTML tables. It's simple to use and is able to handle most of the things you would need it for. Here, in this recipe, we're going to use it with DataTable to create an interactive HTML table that is sortable and searchable. It even has pagination! This recipe populates the table using a database query. If you're not looking for that and just want a simple table, try the preceding recipe—Using an HTML table with DataTable.

Getting ready

For this recipe, you will have to:

  1. Ensure that you've downloaded DataTable from
  2. Unzip the downloaded .zip file, and move the files to a location on your web server or localhost, which ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.