Example #1
2
        <div class="row">
          <div class="col-xs-12 text-center">
            <h3>List All Names & Emails</h3>
          </div>
          <div class="col-xs-12 col-md-8 col-md-offset-2">
            <table class="table table-striped table-bordered">
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Email</th>
                </tr>
              </thead>
              <tbody>
<?php 
//Get all records
$items = getAllItems();
if ($items) {
    foreach ($items as $item) {
        ?>
                <tr>
                  <td><?php 
        echo $item['NAME'];
        ?>
</td>
                  <td><?php 
        echo $item['EMAIL'];
        ?>
</td>
                </tr>
<?php 
    }
Example #2
0
<?php

include '__database.php';
include '__functions.php';
if ($_GET['type'] == 'get_posts') {
    $items = getAllItems($_GET['start']);
    createItems($items);
}
function getItems()
{
    $items = getAllItems();
    return $items;
}
require_once 'connect.php';
require_once 'models.php';
require_once 'tinyORM.php';
use Aws\DynamoDb\Enum\Type;
use Aws\DynamoDb\Enum\ComparisonOperator;
// get all items, even above 1MB
function getAllItems($table)
{
    global $dynamoDB;
    $items = array();
    $finished = false;
    $LastEvaluatedKey = 0;
    while (!$finished) {
        $options = array('TableName' => $table);
        if ($LastEvaluatedKey) {
            $options['ExclusiveStartKey'] = $LastEvaluatedKey;
        }
        $response = $dynamoDB->scan($options);
        $items = array_merge($items, $response['Items']);
        $LastEvaluatedKey = isset($response['LastEvaluatedKey']) ? $response['LastEvaluatedKey'] : 0;
        $finished = $LastEvaluatedKey == 0;
    }
    return $items;
}
$table = 'team_question';
$items = getAllItems($table);
foreach ($items as $item) {
    $item = $tinyOrm->deformatAttributes($item);
    unset($item['ID']);
    $tinyOrm->insertSQL($table, $item);
}