It depends how complicated you want to make it. The PHP that populates MySQL it very similar to AWS tutorial Dan wrote.
For the products table here's some columns you'll need:
ID (auto_increment)
Title
ASIN (set to unique to avoids duplicate listings)
and for the Reviews:
ID (auto_increment)
For_ASIN (which product is this review for)
Subject
Rating
Review
One thing to look out for is some of the Product Names use comma's and other characters that cause MySQL to return an error. To avoid this you can use addslashes() function in PHP, example:
Code:
if (empty($i['ProductName'])) {
$Title = "null";
} else {
$Title = addslashes($i['ProductName']);
}
Here's how i setup the page that adds the items automatically.
Near the top of your script set or retrieve the page set in the usual way:
if (!$_GET['page']) { $page = 1; } else { $page = $_GET['page']; }
Set the total items variable:
$total = $result['TotalResults'];
and the total pages:
$maxPages = ceil($total/10);
To avoid querying AWS more than once a second use a Javascript function to delay loading the next page set you want to load into MySQL:
if ($page >= $maxPages)
{
echo "Finished loading";
}
else
{
echo "Loaded page " .$page. " of " .$maxPages;
$page++; ?>
<SCRIPT LANGUAGE = "JavaScript">
function nextPage() {
window.location = "AWSfeed.php?page=" + <? echo $page ?>;
}
setTimeout("nextPage()", 1000);
</SCRIPT>
Aside from how you Insert into and structure your Tables thats about it.
Bookmarks