RedBeanPHP:查找 属性 为空的所有书籍?
RedBeanPHP: find all books where property is null?
我试过了,但没有得到任何结果:
$Books= R::findAll( 'books' , ' WHERE accepted IS NULL ORDER BY update_time DESC LIMIT 100 ' );
我该怎么办?
编辑:
我的PHP:
$requests = array();
$Books = R::findAll( 'books' , ' ORDER BY update_time DESC LIMIT 100 ' );
foreach ($Books as &$value) {
$request = new stdClass();
$request->name= $value->name;
$request->accepted = $value->accepted;
$request->id = $value->id;
$requests[] = $request;
}
print_r(json_encode((object)$requests));
在 Javascript 我做了一个 console.log(object);我明白了:
Object
0: Object
name: "Mem û Zîn"
accepted: null
id: "1"
1: Object
...
使用 "WHERE" 语句和 R::findAll 我什么也得不到。
编辑:
好的,感谢@gbelisario 这有效:
$Books = R::getAll( 'select * from books WHERE accepted IS NULL ORDER BY update_time DESC LIMIT 100 ' );
foreach ($Books as &$value) {
$requests[] = $value;
}
print_r(json_encode((object)$requests));
你试过吗?
R::getAll( 'select * from books WHERE accepted IS NULL ORDER BY update_time DESC LIMIT 100 ' );
我正在使用 redbean,它适用于
R::find ( 'bean', "battribute is NULL" );
也是
我试过了,但没有得到任何结果:
$Books= R::findAll( 'books' , ' WHERE accepted IS NULL ORDER BY update_time DESC LIMIT 100 ' );
我该怎么办?
编辑:
我的PHP:
$requests = array();
$Books = R::findAll( 'books' , ' ORDER BY update_time DESC LIMIT 100 ' );
foreach ($Books as &$value) {
$request = new stdClass();
$request->name= $value->name;
$request->accepted = $value->accepted;
$request->id = $value->id;
$requests[] = $request;
}
print_r(json_encode((object)$requests));
在 Javascript 我做了一个 console.log(object);我明白了:
Object
0: Object
name: "Mem û Zîn"
accepted: null
id: "1"
1: Object
...
使用 "WHERE" 语句和 R::findAll 我什么也得不到。
编辑: 好的,感谢@gbelisario 这有效:
$Books = R::getAll( 'select * from books WHERE accepted IS NULL ORDER BY update_time DESC LIMIT 100 ' );
foreach ($Books as &$value) {
$requests[] = $value;
}
print_r(json_encode((object)$requests));
你试过吗?
R::getAll( 'select * from books WHERE accepted IS NULL ORDER BY update_time DESC LIMIT 100 ' );
我正在使用 redbean,它适用于
R::find ( 'bean', "battribute is NULL" );
也是