From 9388c571ae89840de963f5264a5e274b132298df Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 18 Apr 2010 22:41:28 +0000 Subject: [PATCH] Send IDs for divs/cats as part of the array data, not just as the index. --- remote.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/remote.php b/remote.php index ea08276..8463183 100644 --- a/remote.php +++ b/remote.php @@ -370,7 +370,8 @@ function handle_get_categories(&$u, &$fair, &$data, &$response) $cat = array(); $q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); while($r=mysql_fetch_object($q)) { - $cat[$r->id]=array('category' => $r->category, + $cat[$r->id]=array('id' => $r->id, + 'category' => $r->category, 'mingrade' => $r->mingrade, 'maxgrade' => $r->maxgrade); } @@ -384,7 +385,8 @@ function handle_get_divisions(&$u, &$fair, &$data, &$response) $div = array(); $q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); while($r=mysql_fetch_object($q)) { - $div[$r->id] = array('division' => $r->division); + $div[$r->id] = array('id' => $r->id, + 'division' => $r->division); } $response['divisions'] = $div; $response['error'] = 0; @@ -466,6 +468,7 @@ function handle_award_additional_materials(&$u, &$fair, &$data, &$response) if(array_key_exists('get_categories', $data)) handle_get_categories($u,$fair,$data, $response); if(array_key_exists('get_divisions', $data)) handle_get_divisions($u,$fair,$data, $response); if(array_key_exists('award_additional_materials', $data)) handle_award_additional_materials($u,$fair,$data, $response); + // $response['hi'] = 'hi'; echo urlencode(json_encode($response)); // echo "Success!
";