In my system there are two tables called ‘faculty’ and ‘faculty_assets’.
I need to delete faculty by faculty from the ‘faculty’ table. But system should allow deleting the faculty when only faculty_assets table empty. Otherwise It should not allows to delete the faculties from ‘faculty’ table.
Can anyone modify below sql query? (‘fac_id’ is the primary key of ‘faculty’ table )
function removeFaculty($fac_id){
$conn=new connection();
$sql="delete from faculty where fac_id='$fac_id'";
$result=$conn->query($sql);
return $result;
}