From d38c57de79fdee59df12543f804bc00cdc231ce1 Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 10 Feb 2010 05:36:14 +0000 Subject: [PATCH] Delete entries in the winners table when a project is deleted. --- admin/registration_list.php | 5 +++++ 1 file changed, 5 insertions(+) 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']."'");