Delete entries in the winners table when a project is deleted.

This commit is contained in:
dave 2010-02-10 05:36:14 +00:00
parent 6bd6f971ac
commit d38c57de79

View File

@ -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']."'");