Answer the question
In order to leave comments, you need to log in
How to populate a 2D array in PHP?
Using mysqli_fetch_assoc I'm trying to populate an array with data from the database, but I'm too dumb for this. I don't understand how to do it.
There is a code:
if ($result = mysqli_query($link, 'SELECT * FROM `tests`'))
{
while ( $row = mysqli_fetch_assoc($result))
{
echo 'ВОПРОС:' ,$row['QUESTION'];
}
}
Answer the question
In order to leave comments, you need to log in
Where is the two-dimensional array actually in the code?
So, for example, the $dumb array will be filled two-dimensionally:
$dumb=array();
if ($result = mysqli_query($link, 'SELECT * FROM `tests`'))
{
while ( $row = mysqli_fetch_assoc($result))
{
$dumb[]=$row;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question