Answer the question
In order to leave comments, you need to log in
How to display an array in php in key value format?
There is an array generated by the mysqli_fetch_all( ) function. Namely, the data derived from the database table:
$stock_data = mysqli_fetch_all(mysqli_query($connection, "SELECT * FROM `stock`"));
foreach ($stock_data as $key => $value) {
echo "{$key} => {$value} ";
}
Answer the question
In order to leave comments, you need to log in
1. You first need to understand in what form the data comes from mysqli_fetch_all, and then write a loop for processing.
2. You will have to process each entry in a loop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question