Search code examples
redbean

How to update table using "beans"


How do I convert this query to redbeans?

update trips set title="test" where title="Rome 9 days" 

I know I cand do R:: exec () but I am wondering if it's the only way.


Solution

  • $bean = R::findOne('trips', 'title = ?', array('Rome 9 days'));
    $bean->title = "test";
    R::store($bean);
    

    This should work