如果符合某些条件,我的代码应该从personprofile
表中获取数据并将其插入organandtissuedonationcommittee
表。我究竟做错了什么。请帮忙
// check the prioritylvl if 1 insert organstatus as transplant completed if 2 or 3 then organstatus as pending
// only taking whatever data is in the first row
//select name,insurnce,admissionreason
$sqlpersonprofile= "SELECT firstname,fathername,lastname,medicalinsurance,prioritylvl,admissionreason
FROM personprofile";
$patients= mysqli_query($link,$sqlpersonprofile);
$processpriority= mysqli_fetch_assoc($patients);
$firstname= $processpriority['firstname'];
$fathername= $processpriority['fathername'];
$lastname= $processpriority['lastname'];
$medinsurance= $processpriority['medicalinsurance'];
$prioritylvl= $processpriority['prioritylvl'];
$admissionreason= $processpriority['admissionreason'];
if($prioritylvl= 1 && $admissionreason = 5){
$sqlcommittee= "INSERT INTO organandtissuedonationcommittee(firstname,fathername,lastname,insurance,organstatus)
VALUES('$firstname','$fathername','$lastname','$medinsurance','Organ donated')";
$committee = mysqli_query($link, $sqlcommittee);
if(!$committee){
echo 'Not inserted';
}
}
else{if($prioritylvl= 2 || $prioritylvl = 3 && $admissionreason = 5 ){
$sqlcommittee= "INSERT INTO organandtissuedonationcommittee(firstname,fathername,lastname,insurance,organstatus)
VALUES('$firstname','$fathername','$lastname','$medinsurance','Pending')";
$committee = mysqli_query($link, $sqlcommittee);
if(!$committee){
echo 'Not inserted';
}
}
}