我已阅读其他帖子,例如pagination in simpledb,但我有点不清楚为什么我的代码无效。我相信这个问题对于我看不到的人来说是显而易见的。
//First I perform a count based on the suggestion in https://stackoverflow.com/questions/4623324/pagination-in-simpledb
$result = $client->select(array('SelectExpression' => "select count(*) from mydomain Where city='Dallas'"));
//I get back ~ 300 records when I check:$result['Items']['0']['Attributes']['0']['Value']
//Next I will query using count for the first 10 records so I can obtain the NextToken.
$result = $client->select(array('SelectExpression' => "select count(*) from mydomain Where city='Dallas' limit 10"));
//This works I see the 'NextToken'
$nexttoken = $result['NextToken'];
//Now I will fire off my final query this time I would like to use the NextToken
//My goal here is to pick up starting at record 11
$result = $client->select(array('SelectExpression' => "select * from mydomain Where city='Dallas' limit 10"),array('NextToken' => $nexttoken ));
查询成功但我每次都获得前10条记录。我期待11-20的记录
看起来像NextToken被忽略了。 : - (
我确信这是愚蠢的,但我似乎无法让NextToken工作。
我搞砸的任何想法?
由于
=======================
使用适用于PHP的AWS SDK的NextToken时,您必须创建一个包含查询和下面的NextToken示例的单个数组
$params = array('SelectExpression' => "select * from mydomain WHERE City ='Dallas' LIMIT 10");
$params['NextToken'] = $result['NextToken']; //Obtained from the count query we ran earlier
$result = $client->select($params);
祝你好运。
答案 0 :(得分:0)
问题已解决,所以我想分享这个以防其他人遇到此问题。
使用适用于PHP的AWS SDK的NextToken时,您必须创建一个包含查询和下面的NextToken示例的单个数组
$params = array('SelectExpression' => "select * from mydomain WHERE City ='Dallas' LIMIT 10");
$params['NextToken'] = $result['NextToken']; //Obtained from the count query we ran earlier
$result = $client->select($params);