prepare($sql); $stmt->execute(); if ($stmt->rowCount() > 0) { // Fetch the record $row = $stmt->fetchAll(PDO::FETCH_ASSOC); jsonSuccess($row); } else { // No records found echo "No records found."; } ?>