Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gabor  >  Red Bean PHP  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Short Example
Class: Red Bean PHP
Store and retrieve objects in SQLite databases
Author: By
Last change:
Date: 4 years ago
Size: 458 bytes
 

Contents

Class file image Download
<?php

require("rb.php");

//Init database -- default is SQLite
R::setup();
//All tables created on the fly...
$cat R::dispense("cat"); //no need for model
$cat->name "Tom";
$id=R::store$cat ); //store cat
$cat R::load("cat"$id);
echo 
$cat->name;

$mouse R::dispense("mouse");
$mouse->name="Jerry"//props added on the fly!
R::store($mouse);
R::link($cat,$mouse);
$mouse R::getBean($cat,"mouse");
echo 
" and ".$mouse->name;