I am trying to get information into my database and am running into a problem that I am sure I am just making a simple mistake. To update the table I am using:
$conn->query("update webPrice set price= " . $amazonResult['price'] . " where asin = '" . $amazonResult['asin'] . "'");
$conn is my connection. The price is consistently entered as 0. I know there is information there since when I do print_r($amazonResult) I see everything that I want to insert into the DB. Code to get amazon info is:
foreach($parsed_xml->GetMyPriceForASINResult as $item ) {
$asin2 =$item->attributes()->ASIN;
$current = $item->Product;
$status = $item->attributes()->status;
if (stristr($status, "Success") == true)
{
$amazonResult = array(
'asin' => $asin2,
'price' => $current->Offers->Offer->BuyingPrice->ListingPrice,//AttributeSets->children('ns2', true)->
);
I think the issue is with my update statement, but I an not sure what it is. The asin info is entered correctly. the fields are price = double and asin = varchar.
EDIT: here is the result of print_r($amazonResult);
Array ( [asin] => SimpleXMLElement Object ( [0] => 0176055452 ) [price] => SimpleXMLElement Object ( [CurrencyCode] => USD [Amount] => 10.11 ) )