ok

Mini Shell

Direktori : /proc/self/root/home/ngwcolle/www/LIBRARY-NGWC/admin/ajax/
Upload File :
Current File : //proc/self/root/home/ngwcolle/www/LIBRARY-NGWC/admin/ajax/add_class.php

<link rel="stylesheet" href=",,/assets/js/plugins/datatables/dataTables.bootstrap4.min.css">

<link rel="stylesheet" id="css-main" href="../assets/css/codebase.min.css">

<?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 = '';
//  $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["name"];
//     $assigndate=$_POST['assigndate'];
$age=$_POST['age'];
$desc=$_POST['desc'];
$minage=$_POST['minage'];
// $nextclass=$_POST['lastclassclass'];
$sql="insert into tblclass(classname,classdesc,startdate,minage,status)values(:name,:classdesc,:startdate,:minage,1)";
$query=$dbh->prepare($sql);
$query->bindParam(':name',$name,PDO::PARAM_STR);
$query->bindParam(':classdesc',$desc,PDO::PARAM_STR);
$query->bindParam(':startdate',$age);
// $query->bindParam(':nextclass',$nextclass);
$query->bindParam(':minage',$minage);
// $query->bindParam(':status',1);
//  $query->execute();
    if($query->execute())
    {
       $cnt=0;
        $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">Data Inserted</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;
}
?>

<script src="../assets/js/core/jquery.min.js"></script>
        <script src="../assets/js/core/popper.min.js"></script>
        <script src="../assets/js/core/bootstrap.min.js"></script>
        <script src="../assets/js/core/jquery.slimscroll.min.js"></script>
        <script src="../assets/js/core/jquery.scrollLock.min.js"></script>
        <script src="../assets/js/core/jquery.appear.min.js"></script>
        <script src="../assets/js/core/jquery.countTo.min.js"></script>
        <script src="../assets/js/core/js.cookie.min.js"></script>
        <script src="../assets/js/codebase.js"></script>
 <!-- Page JS Plugins -->
 <script src="../assets/js/plugins/datatables/jquery.dataTables.min.js"></script>
        <script src="../assets/js/plugins/datatables/dataTables.bootstrap4.min.js"></script>

        <!-- Page JS Code -->
        <script src="../assets/js/pages/be_tables_datatables.js"></script>

Zerion Mini Shell 1.0