I have two queries which I want to combine together in order to get information from two different tables into one array.
$stmt = $pdo->query("SELECT * FROM Product WHERE id=". $productid);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$itemData = array(
'id' => $row['id'],
'name' => $row['name'],
'unitprice' => $row['unitprice'],
'quantity' => 1
);
I would like to add this to the same stmt
SELECT size FROM ProductDetails where id=".$productid);
and then have the $itemData array as follows:
$itemData = array(
'id' => $row['id'],
'name' => $row['name'],
'size' => $row['size'],
'unitprice' => $row['unitprice'],
'quantity' => 1
);
Is there a possible way to do this? Thank you.