ok
Direktori : /home/ngwcolle/public_html/LIBRARY-NGWC/admin/ajax/ |
Current File : //home/ngwcolle/public_html/LIBRARY-NGWC/admin/ajax/add_section_seat.php |
<?php // session_start(); //error_reporting(0); // include('../includes/config.php'); include('../includes/dbconnection.php'); // if (strlen($_SESSION['adid']==0)) { // header('location:logout.php'); if(!empty($_POST)) { $output = ''; $cnt=0; // $name = mysqli_real_escape_string($con, $_POST["name"]); // $address = mysqli_real_escape_string($connect, $_POST["address"]); // $gender = mysqli_real_escape_string($connect, $_POST["gender"]); // $designation = mysqli_real_escape_string($connect, $_POST["designation"]); $name = $_POST["aclass"]; // $assigndate=$_POST['assigndate']; $age=$_POST['asec']; $desc=$_POST['addseat']; // $sql="UPDATE tblsection set strength=strength(classid,sectioncode,strength,vacancy)values(:name,:classdesc,:startdate,:vacancy)"; $queryupdate=$dbh->exec("update tblsection set strength=strength+$desc where classid=$name and id=$age"); // $query=$dbh->prepare($sql); // $query->bindParam(':name',$name); // $query->bindParam(':classdesc',$age); // $query->bindParam(':startdate',$desc); // $query->bindParam(':vacancy',$desc); // $query->bindParam(':status',1); // $query->execute(); if($queryupdate) { $queryseatupdate=$dbh->exec("update tblsection set vacancy=strength-filled where classid=$name and id=$age"); // $last_id = $dbh->lastInsertId(); // if($last_id){ // // $idd = str_replace("SSVMCLS", "", $last_id); // $id = str_pad($last_id, 4, 0, STR_PAD_LEFT); // $settle_id="SSVMCLS".$id; // $update = $dbh->prepare("UPDATE tblclass SET classcode='$settle_id' WHERE id='".$last_id."'"); // // $update->bindParam(':settlementid', $settle_id); // $update->execute(); // } $output .= '<label class="text-success">Section Added to the Class</label>'; // $select_query = "SELECT * FROM "; // $result = mysqli_query($con, $select_query); $select = $dbh->prepare("SELECT tc.*,sum(ts.strength)as tot,count(ts.sectioncode) as counts from tblclass tc left join tblsection ts on tc.id=ts.classid GROUP by tc.id order by tc.id asc"); $select->execute(); $output .= ' <table class="table table-bordered table-striped table-vcenter js-dataTable-full-pagination"> <tr> <th class="text-center">ID</th> <th>Class Name</th> <th>Class Code</th> <th>No of Sections</th> <th>Student Strength</th> <th class="d-none d-sm-table-cell">Creation Date</th> <th class="d-none d-sm-table-cell" style="width: 15%;">Action</th> </tr> '; while($row=$select->fetch(PDO::FETCH_OBJ)){ { $cnt=$cnt+1; $active="Exit"; if(isset($row->status)){ $active="Active"; } $output .= ' <tr> <td>' . $cnt . '</td> <td>' . $row->classname . '</td> <td>' . $row->classcode . '</td> <td class="d-none d-sm-table-cell"> <span class="badge badge-primary">'.$row->counts.'</span></td> <td class="d-none d-sm-table-cell"> <span class="badge badge-primary">'.$row->tot.'</span></td> <td class="d-none d-sm-table-cell"> <span class="badge badge-primary">'.$row->startdate.'</span></td> "<td><a href="edit.php?id='.$row->id.'" onclick="return confirm(\'Are you sure you want to delete?\');"> <i class="fa fa-trash fa-delete" aria-hidden="true"></i> </a></td> </tr> '; } } $output .= '</table>'; } echo $output; } ?>