K
K
Keliorw2021-06-06 23:30:10
PHP
Keliorw, 2021-06-06 23:30:10

Why does it give an error if the table name contains "_" this character?

Error text:

Fatal error : Uncaught RedBeanPHP\RedException: Invalid type: dle_users in C:\OpenServer\domains\neonium\assets\libs\rb-mysql.php:15389
Stack trace:
#0 C:\OpenServer\domains\neonium\assets\libs \rb-mysql.php(15463): RedBeanPHP\Util\DispenseHelper::checkType('dle_users')
#1 C:\OpenServer\domains\neonium\assets\libs\rb-mysql.php(12395): RedBeanPHP\Util \DispenseHelper::dispense(Object(RedBeanPHP\OODB), 'dle_users', 1, false)
#2 C:\OpenServer\domains\neonium\assets\Controller\User.php(25): RedBeanPHP\Facade::dispense( 'dle_users')
#3 C:\OpenServer\domains\neonium\assets\Controller\User.php(42): User->CreateUser()
#4 {main}
thrown in C:\OpenServer\domains\neonium\assets\ libs\rb-mysql.php on line15389


$user = R::dispense("dle_users");
            $user->email = $this->email;
            $user->password = $this->password;
            $user->name = $this->name;
            $user->lastdate = time();
            $user->reg_date = $this->reg_date;
            $user->allow_mail = $this->allow_mail;
            $user->logged_ip = $this->LoggedIpUser;
            $user->accessToken = $this->accessToken;
            $_SESSION['logged_user'] = $user;
            R::store($user);


public static function checkType( $type )
  {
    if ( !preg_match( '/^[a-z0-9]+$/', $type ) ) {
      throw new RedException( 'Invalid type: ' . $type );
    }
  }


I will be glad if you tell me how to write data to a table with this name)))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question