title: How to fetch data from two tables info using php
body: <p>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: </p>
  
  <pre><code>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);
  </code></pre>
  
  <p>it prints here query empty </p>