firstname . "','" . $post->lastname . "',"; $sql .= $post->groupid . ", '" . $post->sex . "','" . $post->date_of_birth . "', '" . $post->date_joined . "',''"; $result = $mysqli->query($sql); $sql = "SELECT * FROM apprentice Order by apprenticeid desc LIMIT 1"; $result = $mysqli->query($sql); $data = $result->fetch_assoc(); echo json_encode($data); ?>