8
8
8dc6e5eb225147476bd02019-03-13 13:55:34
PHP
8dc6e5eb225147476bd0, 2019-03-13 13:55:34

How to change the value of a Redbean entry?

There is the following code:

$findone = R::findOne('users', 'username = ?', array($_SESSION['log_data']));
$loadya = R::load('users', $findone->id);
$load_time = $findone->time+50;
$loadya->time = $load_time;
R::store($loadya);

This code should take the existing 'balance' and add 50 to it, but instead it adds a new entry with all null fields except time. Can anyone suggest what is wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hojiakbar Solizhanov, 2019-09-30
@newqwertyplayer

$findone = R::load('users', array($_SESSION['log_data']);
$c_time = $findone->time+50;
$findone ->time = $c_time;
R::store($findone );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question