Send IDs for divs/cats as part of the array data, not just as the index.

This commit is contained in:
dave 2010-04-18 22:41:28 +00:00
parent e791a7c1d4
commit 9388c571ae

View File

@ -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!<br />";