I want to get data from two tables. I have patient first name and last name in one table and appointment time in other table. I am using following way but it gives an error:
SELECT
PatientMaster.PatientFirstName,
PatientMaster.PatientLastName,
ProviderAppointmentListings.AppointmentTime
FROM PatientMaster
JOIN ProviderAppointmentListings
ON PatientMaster.PatientID = ProviderAppointmentListings.PatientID
$result = mysql_query($query) OR die(mysql_error());
$rows = array();
while($row = mysql_fetch_assoc($result)) {
$rows[] = $row;
}
echo json_encode($rows);
it prints here query empty
[EDITED]
Try:
If a MySQL error appears, then there must be something wrong with your query.