diff --git a/admin/registration_list.php b/admin/registration_list.php index 3671fe1..e802c37 100644 --- a/admin/registration_list.php +++ b/admin/registration_list.php @@ -51,6 +51,11 @@ case 'load_row': case 'delete': $regid = intval($_GET['id']); + $q = mysql_query("SELECT * FROM projects WHERE registrations_id='$regid'"); + if(mysql_num_rows($q)) { + $p = mysql_fetch_assoc($q); + mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'"); + } mysql_query("DELETE FROM registrations WHERE id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");