患者レコードとその患者 ID に関連付けられた予約を同時に削除しようとしていますが、どちらも機能していません。どこが間違っているのか教えてください。
私のコードは次のとおりです。
<?php
include("includes/staffmenu.php");
include("includes/staffsession.php");
@require_once("includes/dbconfig.inc");
$patid = $_GET['patid'];
$patientname = mysql_query("SELECT * From patient WHERE Patient_ID=$patid");
while($row = mysql_fetch_array($patientname))
{ $pfname=$row['Patient_First_Name'];
$pmname=$row['Patient_Middle_Name'];
$psname=$row['Patient_Surname'];
}
echo "<h1>Success $pfname $pmname $psname (Patient ID: $patid) has been removed from our database, along with any appointments in their name</h1>";
mysql_query("DELETE FROM appointment, patient
USING patient INNER JOIN appointment ON (patient.Patient_ID = appointment.Patient_ID)
WHERE patient.Patient_ID='$patid'");
?>
患者IDの名前がうまくエコーするので、間違いなく患者IDを取得します...