# CodeIgniter User Guide Version 1.6.1

Search User Guide

# Scaffolding

CodeIgniter's Scaffolding feature provides a fast and very convenient way to add, edit, or delete information in your database during development.

Very Important: Scaffolding is intended for development use only. It provides very little security other than a "secret" word, so anyone who has access to your CodeIgniter site can potentially edit or delete your information. If you use scaffolding make sure you disable it immediately after you are through using it. DO NOT leave it enabled on a live site. And please, set a secret word before you use it.

## Why would someone use scaffolding?

Here's a typical scenario: You create a new database table during development and you'd like a quick way to insert some data into it to work with. Without scaffolding your choices are either to write some inserts using the command line or to use a database management tool like phpMyAdmin. With CodeIgniter's scaffolding feature you can quickly add some data using its browser interface. And when you are through using the data you can easily delete it.

## Setting a Secret Word

Before enabling scaffolding please take a moment to set a secret word. This word, when encountered in your URL, will launch the scaffolding interface, so please pick something obscure that no one is likely to guess.

To set a secret word, open your `application/config/routes.php` file and look for this item:

`$route['scaffolding_trigger'] = '';`

Once you've found it add your own unique word.

Note: The scaffolding word can not start with an underscore.

## Enabling Scaffolding

Note: The information on this page assumes you already know how controllers work, and that you have a working one available. It also assumes you have configured CodeIgniter to auto-connect to your database. If not, the information here won't be very relevant, so you are encouraged to go through those sections first. Lastly, it assumes you understand what a class constructor is. If not, read the last section of the controllers page.

To enable scaffolding you will initialize it in your constructor like this:

`<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
`$this->load->scaffolding(``'table_name'`);
}
}
?>`

Where `table_name` is the name of the table (table, not database) you wish to work with.

Once you've initialized scaffolding, you will access it with this URL prototype:

`www.your-site.com/index.php/class/secret_word/`

For example, using a controller named Blog, and abracadabra as the secret word, you would access scaffolding like this:

`www.your-site.com/index.php/blog/abracadabra/`

The scaffolding interface should be self-explanatory. You can add, edit or delete records.

## A Final Note:

The scaffolding feature will only work with tables that contain a primary key, as this is information is needed to perform the various database functions.