forked from science-ation/science-ation
Send IDs for divs/cats as part of the array data, not just as the index.
This commit is contained in:
parent
e791a7c1d4
commit
9388c571ae
@ -370,7 +370,8 @@ function handle_get_categories(&$u, &$fair, &$data, &$response)
|
|||||||
$cat = array();
|
$cat = array();
|
||||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
|
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
|
||||||
while($r=mysql_fetch_object($q)) {
|
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,
|
'mingrade' => $r->mingrade,
|
||||||
'maxgrade' => $r->maxgrade);
|
'maxgrade' => $r->maxgrade);
|
||||||
}
|
}
|
||||||
@ -384,7 +385,8 @@ function handle_get_divisions(&$u, &$fair, &$data, &$response)
|
|||||||
$div = array();
|
$div = array();
|
||||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
|
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
|
||||||
while($r=mysql_fetch_object($q)) {
|
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['divisions'] = $div;
|
||||||
$response['error'] = 0;
|
$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_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('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);
|
if(array_key_exists('award_additional_materials', $data)) handle_award_additional_materials($u,$fair,$data, $response);
|
||||||
|
|
||||||
// $response['hi'] = 'hi';
|
// $response['hi'] = 'hi';
|
||||||
echo urlencode(json_encode($response));
|
echo urlencode(json_encode($response));
|
||||||
// echo "Success!<br />";
|
// echo "Success!<br />";
|
||||||
|
Loading…
Reference in New Issue
Block a user