使用redbeans php的sql查询 [英] sql query using redbeans php

查看:93
本文介绍了使用redbeans php的sql查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用redbeans ORM.我遵循了文档,并尝试执行这样的查询

Hi I am just beginning to use redbeans ORM. I followed the docs and tried doing a query like this

$thebean=R::find("users","id>2");

然后我像这样循环遍历:-

and then I loop through like:-

foreach($thebean as $bean){
echo $bean->username;
}

但是我发现,即使users表包含超过100个数据,上述查询也只会获取最后一个数据.例如:如果我有1到100个用户.我只会获得id = 100的用户.有人可以告诉我我可能做错了吗.

However I find that if the even if the users table contains more than 100 data, the above query only fetches the last data . for eg: if I have users 1 to 100. I only get the user with id=100. Can somebody please tell me what I might be doing wrong.

推荐答案

似乎是id字段有问题.使用tableformatter选项解决了它.

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

这篇关于使用redbeans php的sql查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆