Ok, first off this is my first post and I am a TOTAL noob when it comes to php. with that said I am trying to write a site and have stole various snippets online and have gotten certain things to work but the code probably looks hideous.
Basically what I want from this site is the ability to connect to amazon and get pricing updates (I am grabbing computer parts pricing)*this part I have done
Next, instead of the way that I current have the information shown in tables I would rather have the information in numerous drop down boxes with somebody able to select items from those boxes. After the items are selected I would like to add the totals together on the fly or with a submit button. (I have a feeling I might need Javascript to do this?)
Also I need each drop down to have different items (like 1 drop down would have video card names and prices, the 2nd would have sound card names and prices, etc.) My question here is how do I do this with mysql table? do I need multiple tables to accomplish this?
Anyway thats enough for now and hopefully I was as clear as I could be on what I am looking to do. Here is what I currently have
[CODE]<?php
include “connect.php”;
$getitems=”SELECT itemid,ibsn from amz”;
$getitems2=mysql_query($getitems) or die(“Could not get items”);
while($getitems3=mysql_fetch_array($getitems2))
{
$url=”http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=$acckey&Operation=ItemLookup&ItemId=$getitems3[ibsn]&ResponseGroup=Medium,Offers&Condition=All&MerchantID=Amazon”;
$var=file_get_contents($url);
$pricing=explode(“$”,$var);
$lastindex=sizeof($pricing)-1;
$newprice=$pricing[$lastindex];
$theprice=explode(“.”,$newprice);
$deci=substr($theprice[1],0,2);
$realprice=”$theprice[0].$deci”;
//print “$realprice<br>”;
$updatecron=”Update amz set price=’$realprice’ where itemid=’$getitems3[itemid]'”;
mysql_query($updatecron) or die(“Could not update cron”);
mysql_query(“Delete from bgook”);
}
?>
<?php
$connect = mysql_connect(“localhost”, “games45”, “3000gtgt”) or
die (“Hey, check your server connection.”);
mysql_select_db(“games45_test2″);
$quey1=”select * from amz”;
$result=mysql_query($quey1) or die(mysql_error());
?>
<table border=1 style=”background-color:#F0F8FF;” >
<caption><EM>Current Prices</EM></caption>
<tr>
<th>Item</th>
<th>Price</th>
</tr>
<?php
while($row=mysql_fetch_array($result)){
echo “</td><td>”;
echo $row[‘productname’];
echo “</td><td>”;
echo $row[‘price’];
echo “</td>”;
echo “</tr>”;
}
echo “</table>”;
?>