Answer the question
In order to leave comments, you need to log in
How to make json in a loop?
Hello!
How to make json response in php mysql loop.
$rw = $db->query( "SELECT id,name FROM dle_category WHERE parentid='{$_POST['id']}' ORDER by id ASC" );
while ($row = $db->get_row($rw)) {
$row['name'] = iconv('windows-1251', 'UTF-8', $row['name']);
$v = array($row['id'] => $row['name']);
}
echo json_encode($v);
Answer the question
In order to leave comments, you need to log in
if I have not completely forgotten how to write on it, then
well, in the sense it should be written instead$v = array($row['id'] => $row['name']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question