/var/www/(Del)gepgroup.hk/php-activerecord/examples/simple/simple.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
require_once __DIR__ '/../../ActiveRecord.php';

// assumes a table named "books" with a pk named "id"
// see simple.sql
class Book extends ActiveRecord\Model { }

// initialize ActiveRecord
// change the connection settings to whatever is appropriate for your mysql server 
ActiveRecord\Config::initialize(function($cfg)
{
    
$cfg->set_model_directory('.');
    
$cfg->set_connections(array('development' => 'mysql://test:test@127.0.0.1/test'));
});

print_r(Book::first()->attributes());
?>