V
V
Valax2017-09-20 23:54:34
PHP
Valax, 2017-09-20 23:54:34

How to get values ​​from DB using RedbeanPHP?

Tell me, I wrote the value to the database through a command in redbeanphp

$user->uniq_id = md5($_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT'].mktime());

How to retrieve this value from the database?
$uniq_id = R::findOne ('users','uniq_id = ?',array($data['login']));

tried count, load and a number of other commands...
P/S you need to get the uniq_id recorded in the database for the user during registration ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2017-09-21
@AlexMaxTM

To be honest, I didn't quite understand the question. More precisely, I did not understand the first line of the above code.
And it’s easy to extract the data, if the login is known, then you need to get it by the login field, or whatever name this field is called in your table, for example:

$uniq_id = R::findOne ('users','login = ?',array($data['login']));

V
Valax, 2017-09-21
@Valax

I figured it out, it might be useful to someone
$uniq = R::findOne ('users', "login = ?", array($data['login'])); //get all data from the database
$uniq_id = $uniq->uniq_id; //select value from specific column

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question