<?php
function get_examlabel($class_id_set,$section_id_set){
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'];

// Create connection
$conn_db = mysqli_connect($hostname, $username, $password, $database);
// Check connection
$connected = 0;
			if (!$conn_db) {
				die("Connection failed: " . mysqli_connect_error());
			}


$data_array = array();
	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'";
	}else
	{
		$where_stm = "";	
	}
	
$update_select_sql="SELECT * from `exam_ca_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(isset($class_id_set) && isset($section_id_set)){									
						$data_array[$ca_type][$name] = $value;
					}else{
						$data_array[$a_name][$ca_type][$name] = $value;
					}
				}
				$serial++;
			}	
		}
	}
//	echo "<pre>". print_r($data_array) . "</pre>";
return $data_array;

	}	
?>