<?php
require 'config.php';
$db = new connect();
$students = $db->select("students","ORDER BY students_id ASC");
if( $students != null ){
foreach ($students as $student) {
$student['error'] = '';
$output[] = $student;
}}else{
$student['error'] = 'No students...';
$output[] = $student;
}
echo json_encode($output);
?>
if the database is empty i have error. Notice: Undefined variable: output