How can I turn the code below into a single array when its in the while loop? An example would help.
Here is my PHP code.
while($row = mysqli_fetch_array($dbc)){
$category = $row['category'];
$url = $row['url'];
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Building off mawg’s solution and your new requirement:
This would create an associative array with the category name as the key.
Or you could do:
Which would create an array of associative arrays that would contain the URL and category for each row.