Questions tagged [redbean]

RedBeanPHP is an open-source ORM library written for PHP.

About

RedBeanPHP is open-source object-relational mapping software written in PHP.

The main proponent of this software is the configuration-less way that the software will create the tables and columns on-the-fly as you run your PHP code. It does this by working in a 'fluid' mode where the software will check for requested columns when the code is running and create them if they do not exist, it will even broaden the type of a column, for example if your application changes from storing numbers to text.

Once you are happy with your structure and do not want the data structure to change any further you can invoke the freeze command:

R::freeze( true ); //will freeze redbeanphp

This will lock your schema and prevent changes.

Setup & Using Redbean

RedBeanPHP is packaged up into a single php file (rb.php approx 285KB) so that a single include statement and you're ready to go:

require 'rb.php';

Working with Data

An example of CRUD operations with RedBean:

$post = R::dispense('post');
$post->text = 'Hello World';

$id = R::store($post);       //Create or Update
$post = R::load('post',$id); //Retrieve
R::trash($post);             //Delete

Database Compatibility

RedBean works with many database engines in fluid and frozen mode:

MySQL 5 and higher

SQLite 3.6.19 and higher

PostgreSQL 8 and higher

CUBRID (since 3.2)

Oracle* (since 3.3, read note)

278 questions
0
votes
1 answer

RedBeanPhp how to create an active record model

anyone know it is possible to convert this: $u = R::dispense('users'); $u->login = $this->login; $u->password = $this->password; R::store($u); into this: class User { var $login; var $password; var $id; public function save() { …
reizals
  • 1,245
  • 1
  • 14
  • 21
0
votes
1 answer

AJAX is temperamental or slow when deleting from database

I'm having a problem when I use AJAX to edit an SQL database through PHP. It works in effect, but you have to click the "remove" button, refresh the page to see it hasn't worked and then do the exact same thing again which then works, or sometimes…
Josh
  • 1
0
votes
1 answer

Composite data with Redbean

I've just read the Redbean Documentation, and it's awesome! But I have some questions before I proceed. I want to create a User data structure composed in a particular way. On the site I'm working on, I have three types of users: The…
cl0udw4lk3r
  • 2,663
  • 5
  • 26
  • 46
0
votes
1 answer

Using redbean in a loop to store data

I am using redbean to create my site and I am currently implementing a recipe upload feature for users. In the 'upload recipe' form I have used javascript to dynamically add 4 input fields together (amount, measurement, ingredient, notes). I don't…
MikeHolford
  • 1,851
  • 2
  • 21
  • 32
0
votes
0 answers

predictably random duplicates from incremental counter after db query

Preface: I'm using Zend Framework 1.12 and RedBean PHP. The function below queries the table to see if any entries exist. If true, it strips the numerical value from the filename, increments it, then returns it. Pretty simple. If no entries exist,…
orderofout
  • 13
  • 2
0
votes
0 answers

Check user session using jquery, php and red bean

I've spent more than month trying to make rate system , I really start boring about using jquery :( I've implemented this tutorial however, this tutorial allows anyone to vote for unlimited time I successfully join this rating system with mysql DB…
Haifa_ash
  • 35
  • 1
  • 8
0
votes
2 answers

postgresql schemas in redbeanPHP

I'm migrating from MySQL to PostgreSQL and I would like to use some advanced database layer in PHP. RedbeanPHP looks really nice to me, but I can't find how to use different postgres schemas. I've only found some old post and there is written that…
Peter Krejci
  • 3,182
  • 6
  • 31
  • 49
0
votes
1 answer

(Redbean) Unable to access linked table values

I am testing out the Redbean ORM. I like how it works, less work for me :) I am using the redbean books example, from their website. I have been able to create new books with authors and titles, and display them to the page with no problem. I added…
mjparker78
  • 63
  • 5
0
votes
2 answers

RedBean Php PDOException

I have a client who is getting the error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (4)' in /htdocs/library/rb.php:65 The really odd thing here is that…
nicholas
  • 14,184
  • 22
  • 82
  • 138
0
votes
1 answer

PHP Red Bean Not returning correct result

I have 3 tables. Episode, Season, Episode_Season I have made a view as such "CREATE VIEW episode_season_view AS SELECT * FROM episode INNER JOIN episode_season ON episode.id = episode_season.episode_id INNER JOIN season ON season.id =…
furier
  • 1,934
  • 1
  • 21
  • 39
0
votes
1 answer

When using redbean on xampp I noticed this error

I am trying to test out redbeanphp and tried implementing it on xampp with my mac. However it seems like there is something wrong with my pdo. I've checked that a pdo driver for mysql is set up using phpinfo. Can anyone please provide some…
shaoming
  • 37
  • 2
  • 6
0
votes
1 answer

RedBean (ORM) Get Bean with his relations like other Bean

I'm storing a product Bean, by this way: $product = R::dispense( 'product' ); $product->name = $_POST['name']; $product->description = $_POST['description']; $product->price = $_POST['price']; $product->category = $_POST['category']; R::store(…
mauriblint
  • 1,802
  • 2
  • 29
  • 46
0
votes
3 answers

converting mysql query to redbean query

Can anyone help me convert this mysql query to redbean query please? SELECT category,sum(price) from transaction GROUP BY category.
0
votes
1 answer

RedBeanPhp fuse with CI 2.1.0 HMVC

the controller class User extends MX_Controller{ function __construct() { parent::__construct(); } function index(){ $r=R::dispense('group'); $r->GroupName="hh"; $i=R::store($r); echo $i; …
-1
votes
1 answer

Array converted to int

I have a problem, I need to convert from an array to a full number, but I don't understand how. i`m using redbeanphp. Help please print_r(R::getRow('SELECT SUM(view) FROM posts WHERE author LIKE ? LIMIT 1', ['dffdfghdfgdf'])); Result: Array (…
Taras
  • 3
  • 3
1 2 3
18
19