Skip to content

Instantly share code, notes, and snippets.

@fabriziomachado
Created September 6, 2011 12:34
Show Gist options
  • Save fabriziomachado/1197425 to your computer and use it in GitHub Desktop.
Save fabriziomachado/1197425 to your computer and use it in GitHub Desktop.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->spark('php-activerecord/0.0.1');
}
public function index() {
$user = new User(array("email_address" => "[email protected]"));
$user->save();
## This should show you the User record that you just created
print_r($user);
## Now do a simple find by email address
$user = User::find_by_email_address("[email protected]");
print_r($user);
## Now do a simple find by primary key
$user = User::find(1);
print_r($user);
$this->load->view('welcome_message');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment