Current File : /home/inlingua/www/noida/icentex_noida/student_ajax.php
<?php 
require('dbConnection.php');

// Include common functions
require('commonFunc.php');

// Include common functions
require('globalVars.php');

// Include the table handler class
require('dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$cid=$_REQUEST['CID'];
 $cid = str_replace( array( '\'', '"', ',' , ';', '<', '>','%20' ), ' ', $cid);
 $sqlQ = "SELECT  recNo, language, level, startdate, enddate FROM ingl_course where courseid='".$cid."' ";
//echo $sqlQ;

$res=mysqli_query($conn,$sqlQ) or die();
$num=mysqli_fetch_object($res);
//print_r($num);

$lang = array("English"=>"14","French"=>"17","German"=>"18","Spanish"=>"19","Hindi"=>"20","IOL"=>"12");	
 $bcat=$lang[$num->language];	
	
 $course_count="SELECT level FROM ingl_billing_main WHERE `bill_category` ='".$bcat."' and bill_details= '".$num->level."' ";

$totcourse_id=mysqli_query($conn,$course_count) or die(mysqli_query($conn,));

$slevel=mysqli_fetch_array($totcourse_id);



if($slevel['level']=='level_1') $table='level_1';
else if($slevel['level']=='level_2') $table='level_2' ;
		else if($slevel['level']=='level_3') $table='level_3';
		else if($slevel['level']=='level_4') $table='level_4';
		else if($slevel['level']=='level_5' ) $table='level_5';
		else if($slevel['level']=='Private' ) $table='level_private';
		else if($slevel['level']=='Customized' ) $table='level_private';
		
		
		
		$echovalue .="<table cellpadding='3'>";
$echovalue .="<tr><td><input type='hidden' name='language' value='".$num->language."' ><b>Language</b></td><td>".$num->language."<br></td></tr>";	
$echovalue .="<tr><td><input type='hidden' name='level' value='".$num->level."' ><b>Level  </b></td><td>".$num->level."<br></td></tr>";	
$echovalue .="<tr><td><input type='hidden' name='startDate' value='".$num->startdate."' ><b>Start date  </b></td><td>".$num->startdate."<br></td></tr>";	
$echovalue .="<tr><td><input type='hidden' name='endDate' value='".$num->enddate."' ><b>End date  </b></td><td>".$num->enddate."<br></td></tr></table>";	
		
$sqlQuery = "SELECT  s.recNo, s.studentName,t.student_recNo  FROM ingl_student s 
left join ". $table." t on s.recNo=t.student_recNo left join ingl_course c on s.courseId=c.recNo
 where c.courseId='".$cid."' order by s.studentName desc ";


$result=mysqli_query($conn,$sqlQuery) or die();
//$echovalue ="<select name='courseid'>";
$k=0;
$echovalue .="<table border='0' cellpadding='3' width='100%'>";
while($row=mysqli_fetch_object($result))
{

if($row->student_recNo >0)
{}
else
{
 if($k%3==0 ) $echovalue .="<tr>";

$echovalue .="<td valign='top'><input name='student_id[]' type='checkbox' checked value='".$row->recNo."'>".$row->studentName."<br></td>";
if($k%3==2 ) $echovalue .="</tr>";
 $k++;
}

}

if($k>0)
{
$echovalue .="<tr><td colspan='3' align='right'>";
$echovalue .="<input type='submit' name='sub' class='submit1' id='sub' value=' Next >>' ><td></tr>";
}
else
{
$echovalue .="<tr><td colspan='3' align='right'>";
$echovalue .="<input type='submit' name='sub' class='submit2' id='sub' value=' Next >>' disabled ><br>(No Student Left)<td></tr>";
}

$echovalue .="</table>";

echo $echovalue;

?>