Redbean R::Find returns empty beans

69 views Asked by At

using this:

    $rdy  = R::find( 'players','room=0');
    $count = count($rdy);
    if($count>1)
    {
        for($i=0;$i<$count;$i++)
        {
            $id = $rdy[$i]->id;
            $user = R::load('players',$id);
            if($user->id!=0)
            {

            //changing $user variables..

            R::store($user);
            }
        }
    }

but beans that R::find() function found give empty fields, am i using it wrong?

1

There are 1 answers

0
Eslam Ehab On

Replace your first line

    $rdy  = R::find( 'players','room=0');

with

   $rdy = R::find('players', " room = ?", [0]);

You can place variables instead of the hard coded 0.

You can also check on multiple properties and pass multiple variables in the array