Answer the question
In order to leave comments, you need to log in
RedBeanPHP not pulling data from bean?
I'm trying to get the id from the bean, but for some reason it does not pull out the id and writes null, despite the fact that the bean successfully pulls from the base and there is a ['id'] key there.
$user = R::dispense('users');
$user->name = $data['login'];
$user->email = $data['email'];
$user->password = password_hash($data['password'], PASSWORD_DEFAULT);
R::store($user);
$user_id = R::find('users', 'WHERE name = ?', array($data['login']));
$_SESSION['user_id']=$user_id->id;
или
$_SESSION['user_id']=$user_id['id'];//оба варианта не работают, хотя везде манулы смотрю- везде обе записи правы
Answer the question
In order to leave comments, you need to log in
I wrote a crutch - the main thing is that it works)
$current_user = R::findOne('users', 'WHERE name = ?', array($data['login']));
$_SESSION['user']=$current_user;
$_SESSION['user_id'] = $current_user->id;
unset($_SESSION['user']);
b_dump($_SESSION);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question