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
-1
votes
1 answer

Sort publications by form data. Error querying database (RedBeanPHP)

I need to sort publications by the data that is received from the form. I get this error: Fatal error: Uncaught [42000] - SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that…
-1
votes
1 answer

How to populate rows from MySQL to dropdown menu using RedbeanPHP

please help me to populate rows from MySQL to dropdown menu. $result = R::getCol("SELECT name FROM language"); I see all beans, but how can I put this beans into dropdown menu and can send multiple values to MySQL?
-1
votes
1 answer

How to use PHP_EOL?

Tell me please, How this PHP code write on RedBean? Or why do I see error? $group->group_list = explode(PHP_EOL, $data['group_list']); Result: Fatal error: Uncaught RedBeanPHP\RedException: Invalid Bean value: property group_list in /var/www/...
arbalet
  • 11
-1
votes
1 answer

RedBean with PostgreSQL

Fatal error: Uncaught exception 'RedBean_Exception_Security' with message 'OODB Store requires a bean, got: string' in C:\xampp\htdocs\test\src\rb.php:5340 Stack trace: #0 C:\xampp\htdocs\test\src\rb.php(6049): RedBean_OODB->unboxIfNeeded('nick')…
Jayme
  • 45
  • 2
  • 10
-1
votes
1 answer

Is it possible to rewrite this mySQL statement as a WHERE clause for redbean ORM?

based on How can I merge these mysql statements I have the following working sql statement: SELECT *, max(DUP_NUMBER) as dup FROM table1 where CONTACTS=1 GROUP BY FIELD_A ORDER BY date LIMIT 3 I am using the redbean ORM…
user1592380
  • 34,265
  • 92
  • 284
  • 515
-1
votes
1 answer

How to access RedBeansPHP Object’s Second Arrray?

I am working with RedBeansPHP 3.3 and have the following PHP object created by RedBeans findOne called $result: RedBean_OODBBean Object ( [null:RedBean_OODBBean:private] => [properties:RedBean_OODBBean:private] => Array ( …
Phillip Berger
  • 2,317
  • 1
  • 11
  • 30
-3
votes
2 answers

Number in database is not updated using RedBeanPHP

Using RedBaeanPHP, I want the page to be updated and add + 1 to the "view". Please help me, I don't understand it very well. $post_id = $_GET['post_id']; $posts = R::load('posts', $post_id); if (isset($_SESSION['recent_posts'])) { …
Taras
  • 3
  • 3
-4
votes
1 answer

Integrating RedBean ORM into Zend Framework

The manual for RedBean suggests a method for integrating the ORM into Zend Framework. From the manual:- open your Zend bootstrap file and add: public function run() { $loader =…
vascowhite
  • 18,120
  • 9
  • 61
  • 77
1 2 3
18
19