0) { $found = []; while ($row = mysqli_fetch_assoc($sql)) { $found[intval($row['kb_article_id'])] = $row; } $audiences = kbAudiencesFor(array_keys($found)); $one = isset($_GET['kb_article_id']); $rows = []; foreach ($found as $kb_article_id => $row) { $rows[] = kbApiRow($row, $audiences[$kb_article_id] ?? [], $one ? kbApiVersions($kb_article_id) : null); } $rows = tagApiAttach($rows, 'kb_article'); echo json_encode(['success' => 'True', 'count' => count($rows), 'data' => $rows]); exit(); } // Output - nothing found require_once '../read_output.php';