sql query using redbeans php

▼魔方 西西 提交于 2019-12-06 15:26:55

Could it be that your syntax is not correct? I have no experience with Redbean, but you might want to do something like this:

$users = R::find('users', 'id > ?', array('2'));
var_dump($users);

Either way, what is your result when you do the following? Does it return all your users or just one?

$users = R::find('users');
var_dump($users);

Seems that it was a problem with the id field. Solved it using tableformatter option.

You have to use "findAll" on the query. So for example:

$thebean = R::findAll('users', 'id > 2' array('id' => 2));

then you can do your standard foreach:

foreach ($thebean as $key => $bean) {

 echo $bean->username;

} 

Could be a problem on the type of field? Are you tried with: $thebean=R::find("users","id>'2'"); ?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!