| Current Path : /var/www/html/venkat/electiveaug22/ |
| Current File : /var/www/html/venkat/electiveaug22/use-allotmentold.php |
<?php
echo $discipline;
$quer23=mysql_query("UPDATE seat_detail SET available = seat_detail.total where dept = '$discipline'") or die("Invalid Access22 !!!");
$quer23=mysql_query("UPDATE itelectivesubmit SET fe = 'n', fes = 'n', a1 = 'n', as1 ='n', as2 ='n', as3 = 'n', a2 = 'n', a3 ='n' where dept = '$discipline'") or die("Invalid Access22 !!!");
$quer23=mysql_query("UPDATE ecelectivesubmit SET fe = 'n', fes = 'n', a1 = 'n', as1 = 'n', as2 = 'n', as3 = 'n', a2 ='n', a3 = 'n' where dept = '$discipline'") or die("Invalid Access22 !!!");
$quer23=mysql_query("UPDATE melectivesubmit SET fe = 'n', fes = 'n', a1 = 'n', as1 = 'n', as2 = 'n', as3 = 'n', a2 ='n', a3 = 'n' where dept = '$discipline'") or die("Invalid Access22 !!!");
$quer23=mysql_query("UPDATE bmelectivesubmit SET fe = 'n', fes = 'n' where dept = '$discipline'") or die("Invalid Access22 !!!");
$quer23=mysql_query("UPDATE delectivesubmit SET fe = 'n', fes = 'n' where dept = '$discipline'") or die("Invalid Access22 !!!");
//$quer1=mysql_query("select semester, discipline from matrix where discipline !='it' and discipline != 'ec' group by discipline") or die("Invalid Access !!!");
if($discipline == "IT") {
$condition = "where discipline = 'it' or discipline = 'li' or discipline = 'se' or discipline = 'wc' or discipline = 'cl' or discipline = 'hc' or discipline = 'is' or discipline = 'ro' or discipline = 'dsm' or discipline = 'dwm' or discipline = 'dcm' or discipline = 'dhm' or discipline = 'dim' or discipline = 'drm' or discipline = 'te' or discipline = 'dtm' ";
//$condition = "where dept = 'it'";
}
else if($discipline =="EC"){
$condition = "where discipline = 'ec' or discipline = 'dmi' or discipline = 'mi' or discipline = 'dem'";
//$condition = "where dept = 'ec'";
}
else if($discipline =="AS") {
$condition = "where discipline = 'dbi' or discipline = 'dbm'";
}
else if($discipline =="BI") {
$condition = "where discipline = 'bi'";
}
else if($discipline == "MT") {
$condition = "where discipline = 'ml' or discipline = 'tm' or discipline = 'se' or discipline = 'wc' or discipline = 'cl' or discipline = 'hc' or discipline = 'is' or discipline = 'ro' or discipline = 'ed'";
//$condition = "where dept = 'it'";
}
echo "<br>".$qq = "select semester, discipline from matrix $condition group by discipline, semester";
$quer1=mysql_query("select semester, discipline from matrix $condition group by discipline, semester order by preference asc") or die("Invalid Accieess !!!");
$b=0;
while ($row = mysql_fetch_array( $quer1 )) {
echo $n[$b]=$row['discipline'];
$sem[$b]=$row['semester'];
$b++;
}
//$n[$b]="it";
//$b++;
//$n[$b]="ec";
//$b++;
for ($p12 = 0; $p12 <= $b-1; $p12++)
{
if($n[$p12] !='li' && $n[$p12] !='it' && $n[$p12] !='ec' && $n[$p12] !='bm') {
if(substr($n[$p12],0,1) == 'd') {
$truncated1 = "delectivesubmit";
}
else {
$truncated1 = "melectivesubmit";
}
}
else {
$truncated1= $n[$p12].'electivesubmit';
}
if($n[$p12] == 'li') {
$truncated1= 'itelectivesubmit';
}
echo $truncated1;
//include("allot.php");
$quer1 = mysql_query("select basket from matrix where semester = $sem[$p12] and discipline='$n[$p12]' group by basket") or die("Invalid Access1 !!!");
while ($row121 = mysql_fetch_array( $quer1 )) {
$baskets = $row121['basket'];
$quer22 = mysql_query("select coursecode, subject, seatno from matrix where semester = $sem[$p12] and discipline='$n[$p12]' and basket='$baskets'") or die("Invalid Access !!!");
$b2=0;
while ($row122 = mysql_fetch_array( $quer22 )) {
$ele[$b2] = $row122['coursecode'];
$seatno = $row122['seatno'];
$seatcode[$b2] = $seatno;
$subject[$b2] = $row122['subject'];
$querseat = mysql_query("select total,available from seat_detail where seatno = '$seatno'") or die("Invalid Accesssesss");
if($row1 = mysql_fetch_array( $querseat )) {
$seat[$b2] = $row1['available'];
$filled_seat_matrix[$b2] = 0;
}
$b2++;
}
$lgp[0] = 1111;
$quer2 = mysql_query("select * from $truncated1 where semester = $sem[$p12] and discipline='$n[$p12]' and basket = '$baskets' order by cgpa desc") or die("Invalid Access !!!");
$s3 = "NIL";
//echo $truncated1." ".$sem[$p12]." ".$n[$p12]." ".$baskets."<br>";
$basketpref = mysql_query("select preference from basket_elective where dept = '$truncated1'") or die ("Invalid Accessesesd !!!");
while($row = mysql_fetch_array($basketpref)) {
echo "single".$single_basket = $row['preference'];
}
if($single_basket == 0) {
$decision = "b";
$single_basket = 1;
}
else {
$decision = "nb";
}
unset($lgp);
while($row = mysql_fetch_array( $quer2 )) {
$s2 = $row['rollno'];
$s3 = $row['basket']; //echo "bye"; echo $s2." "; echo $s3." ";
$lg = $row['cgpa'];
$semester = $row['semester'];
$initialize = 1;
for($b_basket = 0; $b_basket < $single_basket; $b_basket++) {
for($q1 = $initialize; $q1 <= $b2; $q1++) {
$pp = 'p'.$q1;
$pre = $row[$pp];
echo "q1".$q1."b".$b2;
for ( $q2 = 0; $q2 <= $b2-1; $q2++) {
// echo "aa".$ele[$q2]."22".$pre."22<br>";
if($ele[$q2] == $pre) {
// echo "<br>ici"; echo $ele[$q2]." "; echo $pre."<br> ";
if($seat[$q2]>0) {
$quer122 = mysql_query("select subject from matrix where coursecode = '$pre'") or die("Invalid Accesse !!!");
$subjectentry = "null";
while($roww = mysql_fetch_array($quer122)) {
$subjectentry = $roww['subject'];
}
if($decision == "b") {
$quer23 = mysql_query("UPDATE $truncated1 SET fe = '$pre', fes = '$subjectentry', edit =0 where rollno='$s2' and semester = $semester and basket = '$s3'") or die("Invalid Access !!!");
}
else {
echo $single_basket;
echo $d = $b_basket+1;
echo $bv = 'a'.$d;
echo $bvs = 'as'.$d;
$quer23 = mysql_query("UPDATE $truncated1 SET $bv = '$pre', $bvs = '$subjectentry', edit =0 where rollno='$s2' and semester = $semester and basket = '$s3'") or die("Invalid Access-nobasket !!!");
}
$lgp[$q2] = $lg;
$seat[$q2] = $seat[$q2] - 1;
$filled_seat_matrix[$q2] = $filled_seat_matrix[$q2] + 1;;
break 2;
}
}
}
}
echo "q1".$q1;
echo "init".$initialize = $q1+1;
}
}
echo "hellll"."<br>";
for ( $q2 = 0; $q2 <= $b2-1; $q2++) {
$quer23 = mysql_query("UPDATE matrix SET vseats = '$filled_seat_matrix[$q2]',lgp = '$lgp[$q2]' where discipline ='$n[$p12]' and semester = $sem[$p12] and coursecode='$ele[$q2]' and basket = '$s3'") or die("Invalid Access22 !!!");
$quer23 = mysql_query("UPDATE seat_detail SET available = '$seat[$q2]' where seatno ='$seatcode[$q2]'") or die("Invalid Access22 !!!");
echo $sem[$p12]."seat ".$seat[$q2]."seat ".$lgp[$q2]." ".$n[$p12]." ".$ele[$q2]." ".$s3."<br>";
}
}
//}
}
/*$truncated1 = "itelectivesubmit";
$n[$p12]="it";
include("allot.php");
$truncated1 = "itelectivesubmit";
$n[$p12]="ec";
include("allot.php");*/
?>