From af4b50ace04946a31bd84a6580efc3002700e06a Mon Sep 17 00:00:00 2001 From: james Date: Fri, 5 Mar 2010 16:34:52 +0000 Subject: [PATCH] Add a script to manually rollover schools, seems i need to do this in many fairs that rolled over when the rollover was b0rked --- scripts/rolloverschools.php | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 scripts/rolloverschools.php diff --git a/scripts/rolloverschools.php b/scripts/rolloverschools.php new file mode 100644 index 0000000..59e4cdc --- /dev/null +++ b/scripts/rolloverschools.php @@ -0,0 +1,81 @@ + + Copyright (C) 2005-2009 James Grant + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +"; + //award types + $q=mysql_query("SELECT * FROM schools WHERE year='$currentfairyear'"); + echo mysql_error(); + while($r=mysql_fetch_object($q)) { + $puid = ($r->principal_uid == null) ? 'NULL' : ("'".intval($r->principal_uid)."'"); + $shuid = ($r->sciencehead_uid == null) ? 'NULL' : ("'".intval($r->sciencehead_uid)."'"); + + + mysql_query("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal_uid,schoolemail,sciencehead_uid,accesscode,lastlogin,junior,intermediate,senior,registration_password,projectlimit,projectlimitper,year) VALUES ( + '".mysql_real_escape_string($r->school)."', + '".mysql_real_escape_string($r->schoollang)."', + '".mysql_real_escape_string($r->schoollevel)."', + '".mysql_real_escape_string($r->board)."', + '".mysql_real_escape_string($r->district)."', + '".mysql_real_escape_string($r->phone)."', + '".mysql_real_escape_string($r->fax)."', + '".mysql_real_escape_string($r->address)."', + '".mysql_real_escape_string($r->city)."', + '".mysql_real_escape_string($r->province_code)."', + '".mysql_real_escape_string($r->postalcode)."',$puid, + '".mysql_real_escape_string($r->schoolemail)."',$shuid, + '".mysql_real_escape_string($r->accesscode)."', + NULL, + '".mysql_real_escape_string($r->junior)."', + '".mysql_real_escape_string($r->intermediate)."', + '".mysql_real_escape_string($r->senior)."', + '".mysql_real_escape_string($r->registration_password)."', + '".mysql_real_escape_string($r->projectlimit)."', + '".mysql_real_escape_string($r->projectlimitper)."', + '".mysql_real_escape_string($newfairyear)."')"); + } + +?>