I have an array that I created by this query:
$run=0;
$result = $conn->query("SELECT distinct isbn13 from inventory
WHERE quantity>0 and isbn13 like '978%' limit $run, 20");
while($image = $result->fetch_assoc())
{
$isbn[$x] = $image['isbn13'];
$x++;
} //end while
and I need to pass it into this function:
$parsed_xml = ProductId_xml($isbn);
I know there is information in the $isbn because I used print_r($isbn); and saw the array. However, when I do the same in the function (var_dump($searchterm); die;), I get NULL.
Here is part of the function:
count=0;
function ProductId_xml($searchTerm) {
var_dump($searchTerm); die;
$params = array(
'AWSAccessKeyId' => AWS_ACCESS_KEY_ID,
'Action' => "GetMatchingProductForId",
'SellerId' => MERCHANT_ID,
'SignatureMethod' => "HmacSHA256",
'SignatureVersion' => "2",
'Timestamp'=> gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
'Version'=> "2011-10-01",
'MarketplaceId' => MARKETPLACE_ID,
'IdType' => "ISBN",
);
$id=array(explode(',',$searchTerm));
foreach ($id as $newId)
{
$count .= $count +1;
$params += array('IdList.Id.'.$count => $newId);
} //end of foreach
How do I get the information into my function?
The incoming variable
$searchTermshould be an associative array. You don’t need to explode it. You should just be able to access the information by saying$searchTerm['key']or by using a foreach loop.