Skip to content

Instantly share code, notes, and snippets.

@abelcallejo
Last active June 30, 2023 08:47
Show Gist options
  • Save abelcallejo/f7848a5bffc6664da8fa82c2ef31f9e0 to your computer and use it in GitHub Desktop.
Save abelcallejo/f7848a5bffc6664da8fa82c2ef31f9e0 to your computer and use it in GitHub Desktop.
CodeIgniter cheatsheet

CodeIgniter cheatsheet

CodeIgniter v3

A) Using multiple database connections

$writer = $this->load->database('write',TRUE);

$downloader = array(
    'field_a' => 'Value A',
    'field_b' => 'Value B',
    'field_c' => 'Value C',
);

$writer->insert('public_downloaders', $downloader);

B) jQuery post

Set the security key-pair

<script>
var checkpoint = {
    '<?php echo $this->security->get_csrf_token_name(); ?>' : '<?php echo $this->security->get_csrf_hash(); ?>'
};
</script>

Execute the jQuery post request

$.post( "/some/path", checkpoint, function( response ) {
    alert(JSON.stringify(response));
}, "json");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment