开发者

dynamic multi dimensional array creation in php

It may be simple question ,i am fresh to php,amazon I want to do batch put to my SDB database. I download s php-sdb sdk from amazon and did it successfully.

$bPut = $sdb->batch_put_attributes($domineName, array(
  'ItemOne' => array(
    'Company' =>开发者_Go百科 'a',
  ),
  'ItemTwo' => array(
    'Company' => 'a',
  ),
  'ItemThree' => array(
    'Company' => 'a',
  )
), true, null);

its works fine.Now I want to make the array (the second parameter) dynamic ie I want to make itemOne,ItemTwo,ItemThree ... from SDB database , I did it using $key = implode($row['test']); But I am fail to create a multidimensional array successfully>how can I do it.Please help


This:

$items['ItemOne']['Company'] = 'a';
$items['ItemTwo']['Company'] = 'a';
$items['ItemThree']['Company'] = 'a';

will give you this:

array(
  'ItemOne' => array(
    'Company' => 'a'
  ),
  'ItemTwo' => array(
    'Company' => 'a'
  ),
  'ItemThree' => array(
    'Company' => 'a'
  )
);

And then you can use it like so:

$bPut = $sdb->batch_put_attributes($domineName, $items), true, null);


You can view and manage your uploaded data using SDB Explorer. In new upcoming version SDB Explorer will support bulk upload. You will be able to upload your large data in parallel threads.

http://www.sdbexplorer.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜