어떻게 SimpleDB에서 데이터를 가져 옵니까? 내가하고 싶었던 것은 데이터를 넣은 다음 데이터를 가져 오는 것뿐이었습니다. 데이터가 빠져 나오기가 쉽지 않아서 결국 루핑 등으로 추출 할 컴퓨팅 성능이 필요합니다. 맞습니까?PHP를 사용하여 SimpleDB에서 데이터 가져 오기
다음<?php
// Include the SDK
require_once 'sdk.class.php';
// Instantiate
$sdb = new AmazonSDB();
$select_expression = 'SELECT * FROM ' . $domain_name;
$next_token = null;
do {
if ($next_token) {
$response = $sdb->select($select_expression, array(
'NextToken' => $next_token,
));
} else {
$response = $sdb->select($select_expression);
}
// Get Data for row
$body = $response->body->to_array()->getArrayCopy();
echo "ID: " . $msgId . "<br>";
$next_token = isset($response->body->SelectResult->NextToken)
? (string) $response->body->SelectResult->NextToken
: null;
}
while ($next_token);
echo "<br>";
?>
내가 추출하기 위해 노력하고있어 데이터의 추출물 :
다음은 데이터를 추출하려면 코드입니다.Array
(
[@attributes] => Array
(
[ns] => http://sdb.amazonaws.com/doc/2009-04-15/
)
[SelectResult] => Array
(
[Item] => Array
(
[0] => Array
(
[Name] => 1
[Attribute] => Array
(
[0] => Array
(
[Name] => msgAddress
[Value] => +2782555555
)
[1] => Array
(
[Name] => msgType
[Value] => S
)
[2] => Array
(
[Name] => msgSubmitDate
[Value] => 2012-09-02 15:48:46
)
[3] => Array
(
[Name] => msgText
[Value] => Test SMS message for ID no 1
)
)
)
[1] => Array
(
[Name] => 2
[Attribute] => Array
(
[0] => Array
(
[Name] => msgAddress
[Value] => +27825555555
)
[1] => Array
(
[Name] => msgType
[Value] => P
)
[2] => Array
(
[Name] => msgSubmitDate
[Value] => 2012-09-02 15:48:46
)
[3] => Array
(
[Name] => msgText
[Value] => Test phone message for ID no 2
)
)
)
[2] => Array
(
[Name] => 3
[Attribute] => Array
(
[0] => Array
(
[Name] => msgAddress
[Value] => [email protected]
)
[1] => Array
(
[Name] => msgType
[Value] => E
)
[2] => Array
(
[Name] => msgSubmitDate
[Value] => 2012-09-02 15:48:46
)
[3] => Array
(
[Name] => msgText
[Value] => Test email message for ID no 3 to [email protected]
)
)
)
[3] => Array
(
[Name] => 4
[Attribute] => Array
(
[0] => Array
(
[Name] => msgAddress
[Value] => andrebruton
)
[1] => Array
(
[Name] => msgType
[Value] => P
)
[2] => Array
(
[Name] => msgSubmitDate
[Value] => 2012-09-02 15:48:46
)
[3] => Array
(
[Name] => msgText
[Value] => Test push notification message for ID no 4
)
)
)
)
)
)
내가 싶어 모든
다음 변수입니다 :MSGID (이름), MSGTYPE, msgAddress, msgText, msgSubmitDate
나는 그것을 사용하여 얻을 수있는 경우 $ MSGTYPE = 신체 -> SelectResult-> Item-> Name 또는 그와 비슷한 것을 선택하십시오.
내가 데이터를 통해 루프, 토큰 루프 안에 다른 루프를 필요가 있다고 생각합니다. 어떤 도움이 필요합니까? – andrebruton