Example for RedBeanPHP ORM-library

Example for RedBeanPHP (http://redbeanphp.com) ORM-library
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//RedBeanPHP einbinden
require_once('rb.php');
//Datenbankverbindung einrichten
R::setup('mysql:host=localhost;dbname=test','root','password');
/*
Einen neuen Datensatz erzeugen
- Die Tabelle wird automatisch angelegt!
*/
$oEntry = R::dispense('mytable');
$oEntry->title = 'Hello World';
//Datensatz speichern
$iID = R::store($oEntry);
//Laden der gespeicherten Daten
$oEntry = R::load('mytable'$iID);
//Anzeigen des Titels
echo $oEntry->title;
X

Url: http://sklueh.de/2012/11/redbeanphp-die-einfach-zu-verwendende-orm-bibliothek/

Language: PHP | User: sklueh | Created: Sep 24, 2013 | Tags: redbeanphp orm