diff --git a/admin/award_awardcreatedivisional.php b/admin/award_awardcreatedivisional.php
index e442aff..9c97025 100644
--- a/admin/award_awardcreatedivisional.php
+++ b/admin/award_awardcreatedivisional.php
@@ -39,8 +39,10 @@
else if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id'];
//first, we can only do this if we dont have any type=divisional awards created yet
- $q=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE award_types_id='1' AND year='{$config['FAIRYEAR']}'");
- $r=mysql_fetch_object($q);
+
+ $q = $pdo->prepare("SELECT COUNT(id) AS num FROM award_awards WHERE award_types_id='1' AND year='{$config['FAIRYEAR']}'");
+ $q->execute();
+ $r = $q->fetch(PDO::FETCH_OBJ);
if($r->num)
{
echo error(i18n("%1 Divisional awards already exist. There must not be any divisional awards in order to run this wizard",array($r->num)));
@@ -48,21 +50,27 @@
else
{
- $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
- while($r=mysql_fetch_object($q))
+
+ $q = $pdo->prepare("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
+ $q->execute();
+ while($r = $q->fetch(PDO::FETCH_OBJ))
$div[$r->id]=$r->division;
- $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
- while($r=mysql_fetch_object($q))
+
+ $q = $pdo->prepare("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
+ $q->execute();
+ while($r=$q->fetch(PDO::FETCH_OBJ))
$cat[$r->id]=$r->category;
$dkeys = array_keys($div);
$ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") {
- $q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
+
+ $q = $pdo->prepare("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
+ $q->execute();
$divcat=array();
- while($r=mysql_fetch_object($q)) {
+ while($r=$q->fetch(PDO::FETCH_OBJ)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
}
@@ -79,9 +87,11 @@
if($_GET['action']=="create" && $_GET['sponsors_id'])
{
- $q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
+
+ $q = $pdo->prepare("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
+ $q->execute();
$prizes=array();
- while($r=mysql_fetch_object($q))
+ while($r=$q->fetch(PDO::FETCH_OBJ))
{
$prizes[]=array(
"cash"=>$r->cash,
@@ -106,7 +116,8 @@
$c_category=$cat[$c_id];
echo i18n("Creating %1 - %2",array($c_category,$d_division))." ";
- mysql_query("INSERT INTO award_awards (sponsors_id,award_types_id,name,criteria,`order`,year) VALUES (
+
+ $q = $pdo->prepare("INSERT INTO award_awards (sponsors_id,award_types_id,name,criteria,`order`,year) VALUES (
'{$_GET['sponsors_id']}',
'1',
'$c_category - $d_division',
@@ -114,19 +125,26 @@
'$ord',
'{$config['FAIRYEAR']}'
)");
- echo mysql_error();
- $award_awards_id=mysql_insert_id();
+ $q->execute();
+ echo $pdo->errorInfo();
+ $award_awards_id=$pdo->lastInsertId();
- mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES ('$award_awards_id','$c_id','{$config['FAIRYEAR']}')");
- mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES ('$award_awards_id','$d_id','{$config['FAIRYEAR']}')");
+
- $ord++;
+ $q = $pdo->prepare("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES ('$award_awards_id','$c_id','{$config['FAIRYEAR']}')");
+ $q->execute();
+
+ $q = $pdo->prepare("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES ('$award_awards_id','$d_id','{$config['FAIRYEAR']}')");
+ $q->execute();
+ $ord++;
echo " ".i18n("Prizes: ");
foreach($prizes AS $prize)
{
- mysql_query("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,year) VALUES (
+
+
+ $q = $pdo->prepare("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,year) VALUES (
'$award_awards_id',
'{$prize['cash']}',
'{$prize['scholarship']}',
@@ -141,6 +159,10 @@
'{$prize['trophyschoolreturn']}',
'{$config['FAIRYEAR']}'
)");
+
+ $q->execute();
+
+
echo $prize['prize'].",";
}
echo " ";
@@ -157,11 +179,13 @@
echo "
";
echo "
".i18n("Sponsor").":
";
- $sq=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
+
+ $sq = $pdo->prepare("SELECT id,organization FROM sponsors ORDER BY organization");
+ $sq->execute();
echo "