I need help with my SQL Query
<?php
include 'connect.php';
$pdo = Database::connect();
$sql = "SELECT Visit_Date FROM tbl_patient_med_record WHERE PatientID=".$_GET['PatientID'] order by Visit_Date limit 1;
foreach ($pdo->query($sql) as $row){
echo date('F j,Y',strtotime($row['Visit_Date']));
}
Database::disconnect();
?>
The goal is to output the most recent value of Visit_Date. But it seems my code is not working. Any possible remedies for this? Thanks
The error is:
Parse error: syntax error, unexpected 'order' (T_STRING) in C:\xampp\htdocs\capstone_ncd\patient_Profile.php on line 337