I just want to create an application using Slim Framework and RedBeanPHP4, i'm using mysql and the name of database is 'test_api',the db has been created with empty table as my knowledge when using redbeanphp, we could create table on-the-fly. and here is my short code :
<?php
require 'vendor/autoload.php';
// DB
require 'db/rb.php';
R::setup('mysql:host=localhost;dbname=test_api', 'root','mypassword');
R::freeze(true);
// SLIM
$app = new \Slim\Slim();
$app->get('/post', function () use ($app) {
$post = R::dispense('post');
$post->text = 'Hello World';
$id = R::store($post);
echo $id;
});
$app->run();
?>
but i got an error like this :
Slim Application Error
The application could not run because of the following error:
Details
Type: RedBeanPHP\RedException\SQL
Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test_api.post' doesn't exist
File: /srv/http/prj/lpse2/db/rb.php
Line: 631
can anybody here that will help me to solve this issues ?
I had the same problem with RedBeanPHP (4.2)
... even if the table already exists in the DB.
I recently found "a solution":
Replace this portion of code:
by this:
IMO, the exception raised by RB comes from the capital letters of the table name.