我想从两个表中获取数据。我在一张桌子上有耐心的名字和姓氏,在另一张桌子上有预约时间。我使用下面的方法,但它给出了一个错误:如何从两个表中获取数据信息使用php
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);
它打印在这里查询空
请报出确切的错误信息。更好的是,使用搜索来搜索与此确切的错误消息的其他问题。我相信你会找到很多。 – deceze 2012-03-21 06:14:24
表之间的关系?它是一对一还是一对多? – 2012-03-21 06:18:42
@shiplu如何检查关系B/C我有服务器上的客户端数据库如何检查是否存在关系 – 2012-03-21 06:33:35