I am working on the following snippet. How can I load all affected rows into $items
array?
As you can see I am able to fetch each binded cell like $pid
and $psku
but I need to load them to $items
$items =[];
$stmt = $conn -> prepare("SELECT `pid`,`psku` FROM `appolo` ORDER BY `pid` ASC LIMIT 24");
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($pid, $psku);
while ($stmt -> fetch()) {
echo $pid;
echo $psku;
}
$stmt->free_result();
echo json_encode($items);