Here is the error:

Uncaught [3D000] - SQLSTATE [3D000]: Invalid catalog name: 1046 No database selected trace: # 0 Z: \ home \ localhost \ www \ lib \ rb.php (881): RedBeanPHP \ Driver \ RPDO-> runQuery (' SELECT COUNT ( ) ... ', Array)
# 1 Z: \ home \ localhost \ www \ lib \ rb.php (918): RedBeanPHP \ Driver \ RPDO-> GetAll ('SELECT COUNT ( ) ...', Array)
# 2 Z: \ home \ localhost \ www \ lib \ rb.php (3507): RedBeanPHP \ Driver \ RPDO-> GetOne ('SELECT COUNT ( ) ...', Array)
# 3 Z: \ home \ localhost \ www \ lib \ rb.php (5290): RedBeanPHP \ Adapter \ DBAdapter-> getCell ('SELECT COUNT ( ) ...', Array)
# 4 Z: \ home \ localhost \ www \ lib \ rb.php (7305): RedBeanPHP \ QueryWriter \ AQueryWriter-> queryRecordCount ('users', Array, 'login =?', Array)
# 5 Z: \ home \ localhost \ www \ lib \ rb.php (8354): RedBeanPHP \ Repository-> count ('users', 'login =?', Array)
# 6 Z: \ home \ localhost \ www \ lib \ rb.php (11272): RedBeanPHP \ OODB-> count ('users', 'login =?', Array)
# 7 Z: \ home \ localhost \ www \ save_user.php (69): RedBeanPHP \ Facade :: count ('users', 'login =?', Array)
# 8 {main} thrown in Z: \ home \ localhost \ www \ lib \ rb.php on line 719

Here is the code:

require '/lib/rb.php'; R::setup('mysql:host=localhost;dbname = name','root','password'); $user = R::dispense('users'); $user->login = $login; $user->password = $password; $user->gender = $gender; $user->forename = $forename; $id = R::store($user); $user = R::load('users' , $id ); R::freeze(true); 
  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky

2 answers 2

You have not selected a database, probably a problem with the data source string (DSN) in the first argument of the setup method

 R::setup('mysql:host=localhost;dbname = name','root','password'); 

Try to remove the spaces before and after the database name

 R::setup('mysql:host=localhost;dbname=name','root','password'); 

Make sure your database is really called name , and not otherwise.

    Can someone come in handy

     R::setup('mysql:=localhost;dbname=name','root','password');