0) { while ($row = mysqli_fetch_assoc($result)) { $json = array('id' => $row['id'], 'question' => $row['question'], 'answer' => $row['answer'], 'category' => $row['category'], 'categoryName' => $row['name'], 'r' => $row['r'], 'g' => $row['g'], 'b' => $row['b'], 'a' => $row['a'],); } $jsonString = json_encode($json); echo $jsonString; } ?>