Connecting to your Database

There are two ways to connect to a database: Automatically Connecting The “auto connect” feature will load and instantiate the database class with every page load. To enable “auto connecting”, add the word database to the library array, as indicated in the following file: application/config/autoload.php Manually Connecting If only some of your pages require database connectivity you can manually connect to your database by adding this line of code in any function where it is needed, or in your

CI_Table::add_row()

add_row([$args = array()[, ...]]) Parameters: $args (mixed) – An array or multiple strings containing the row values Returns: CI_Table instance (method chaining) Return type: CI_Table Permits you to add a row to your table. You can submit an array or discrete params: $this->table->add_row('Blue', 'Red', 'Green'); $this->table->add_row(array('Blue', 'Red', 'Green')); If you would like to set an individual cell’s tag attributes, you can use an associative array for that

CI_DB_driver::cache_off()

cache_off() Returns: TRUE if caching is on, FALSE if not Return type: bool Disable database results caching.

CI_DB_driver::primary()

primary($table) Parameters: $table (string) – Table name Returns: The primary key name, FALSE if none Return type: string Retrieves the primary key of a table. Note If the database platform does not support primary key detection, the first column name may be assumed as the primary key.

CI_Table

class CI_Table $function = NULL Allows you to specify a native PHP function or a valid function array object to be applied to all cell data. $this->load->library('table'); $this->table->set_heading('Name', 'Color', 'Size'); $this->table->add_row('Fred', '<strong>Blue</strong>', 'Small'); $this->table->function = 'htmlspecialchars'; echo $this->table->generate(); In the above example, all cell data would be ran through PHP’s htmlspecialchars() f

CI_Session::get_flash_keys()

get_flash_keys() Returns: Array containing the keys of all “flashdata” items. Return type: array Gets a list of all $_SESSION that have been marked as “flashdata”.

CI_DB_query_builder::dbprefix()

dbprefix([$table = '']) Parameters: $table (string) – The table name to prefix Returns: The prefixed table name Return type: string Prepends a database prefix, if one exists in configuration.

form_button()

form_button([$data = ''[, $content = ''[, $extra = '']]]) Parameters: $data (string) – Button name $content (string) – Button label $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string Returns: An HTML button tag Return type: string Lets you generate a standard button element. You can minimally pass the button name and content in the first and second parameter: echo form_button('name','content'); // Would produce: <button name="name" t

symbolic_permissions()

symbolic_permissions($perms) Parameters: $perms (int) – Permissions Returns: Symbolic permissions string Return type: string Takes numeric permissions (such as is returned by fileperms()) and returns standard symbolic notation of file permissions. echo symbolic_permissions(fileperms('./index.php')); // -rw-r--r--

CI_Email::attach()

attach($filename[, $disposition = ''[, $newname = NULL[, $mime = '']]]) Parameters: $filename (string) – File name $disposition (string) – ‘disposition’ of the attachment. Most email clients make their own decision regardless of the MIME specification used here. https://www.iana.org/assignments/cont-disp/cont-disp.xhtml $newname (string) – Custom file name to use in the e-mail $mime (string) – MIME type to use (useful for buffered data) Returns: CI_Email instance (method chaining) R