<?php
function get_classlabel($class_id_set=0,$section_id_set=0){
include "application/config/database.php";

$hostname = $db['default']['hostname'];
$username = $db['default']['username'];
$password = $db['default']['password'];
$database = $db['default']['database'];
$dbdriver = $db['default']['dbdriver'];

$data_array = array();
// Create connection
$conn_db = mysqli_connect($hostname, $username, $password, $database);
// Check connection
$connected = 0;
			if (!$conn_db) {
				die("Connection failed: " . mysqli_connect_error());
			}
	//if(isset($class_id_set) && isset($section_id_set)){		
	if(($class_id_set != 0) && ($section_id_set != 0)){		
		$where_stm = " WHERE class_id = '$class_id_set' AND section_id = '$section_id_set' ORDER BY id DESC LIMIT 1";
	}else
	{
		$where_stm = "";	
	}
		$update_select_sql="SELECT * from `exam_result_label` $where_stm;";
$obj ="";
	if ($result_update= mysqli_query($conn_db, $update_select_sql))
	{	
		$serial = 1;		
		if(mysqli_num_rows($result_update)>0){
			while ($obj=mysqli_fetch_assoc($result_update))
			{
				//////to GLOBAL				
				$type = $obj;
				$a=$type;
				$value_name = array_keys($a);
				$posts = $value_name;
					
				foreach ($posts as $value) {///
					$name = $value;	
					$$value =$type[$name];
					$value = $type[$name];
				}
				
				foreach ($posts as $value) {///
					$name = $value;	
					$$value =$type[$name];
					$value = $type[$name];
					$a_name = $class_id . "_" . $section_id;
					if(($class_id_set != 0) && ($section_id_set != 0)){									
						$data_array[$name] = $value;
					}else{
						$data_array[$a_name][$name] = $value;
					}
				}
				$serial++;
			}	
		}
	}
//	echo "<pre>". print_r($data_array) . "</pre>";
return $data_array;	

	}	
?>