How to start project with readbeanphp

Just download redbeanphp  and extract as rb.php

Now lets start

config.php

<?php

include “rb.php”;

R::setup(‘mysql:host=localhost;dbname=mydatabase’,  ‘user’,’password’);

?>

crud.php

<?php

include “config.php”

$post = R::dispense(‘post’);
$post->text = ‘Hello World’;
$id = R::store($post);       //Create Table & save data if not table exist.

$post = R::load(‘post’,$id); //Retrieve
R::trash($post);             //Delete

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s