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.133.124.80
<?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 == 'colldisp')
{
$collarray = [];
$distarray = [];
$talukarray = [];
$colltypearray = [];
$query = "select distinct cl.fcollsspcode,concat(fcollsspcode,' - ',fcollname) as fcollname from logisys3_comexam.dbname db
inner join logisys3_comexam.ssp_college cl on db.fsspcode = funvsspcode
where db.FDBNAME = '{$db}'";
$result1 = mysqli_query($conn, $query);
$i =0;
while($row1 = mysqli_fetch_assoc($result1))
{
$collarray[$i] = $row1;
$i++;
}
$query = "select distinct fdistrictssp, fdistrictname from logisys3_comexam.ssp_taluk";
$result1 = mysqli_query($conn, $query);
$i =0;
while($row1 = mysqli_fetch_assoc($result1))
{
$distarray[$i] = $row1;
$i++;
}
$query = "select distinct ftalukssp, ftalukname from logisys3_comexam.ssp_taluk";
$result1 = mysqli_query($conn, $query);
$i =0;
while($row1 = mysqli_fetch_assoc($result1))
{
$talukarray[$i] = $row1;
$i++;
}
$query = "select distinct fsspcolltype, ffdespn from logisys3_comexam.ssp_college_type";
$result1 = mysqli_query($conn, $query);
$i =0;
while($row1 = mysqli_fetch_assoc($result1))
{
$colltypearray[$i] = $row1;
$i++;
}
$query = "select distinct fcollcode as college_code,concat(fcollname,', ',ftown) as fdescpn,
ifnull(fsspcollcode,'') as ssp_code,
ifnull(FSSPTALUKCODE,'') as FSSPTALUKCODE,
ifnull(FSSPDISTCODE,'') as FSSPDISTCODE,
ifnull(FSSPCOLLTYPE,'') as FSSPCOLLTYPE
from {$db}.college
where ifnull(fdeleted,'') <> 'T'
and fcollcode <> ''
order by fcollcode";
$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="5%"><center>Sl. No.</center></th>
<th width="5%"><center>College Code</center></th>
<th width="20%"><center>College Name</center></th>
<th width="30%"><center>College SSP Code </center></th>
<th width="10%"><center>District SSP Code </center></th>
<th width="10%"><center>Taluk SSP Code </center></th>
<th width="10%"><center>College Type</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['college_code']."</td>";
$table .= "<td>".$row['fdescpn']."</td>";
$table .= "<td><center><select style = 'height:32px; width:400px;' id='sspcode_{$row['college_code']}'>";
$table .= "<option value=''>-Select-</option>";
foreach($collarray as $row1)
{
$Selected=($row['ssp_code']==$row1['fcollsspcode']) ? "selected" : "";
$table .= "<option ".$Selected." value='".$row1['fcollsspcode']."'>".$row1['fcollname']."</option>";
}
$table .= "</select></center></td>";
$table .= "<td><center><select style = 'height:32px;' id='sspdistcode_{$row['college_code']}'>";
$table .= "<option value=''>-Select-</option>";
foreach($distarray as $row1)
{
$Selected=($row['FSSPDISTCODE']==$row1['fdistrictssp']) ? "selected" : "";
$table .= "<option ".$Selected." value='".$row1['fdistrictssp']."'>".$row1['fdistrictname']."</option>";
}
$table .= "</select></center></td>";
$table .= "<td><center><select style = 'height:32px;' id='ssptalukcode_{$row['college_code']}'>";
$table .= "<option value=''>-Select-</option>";
foreach($talukarray as $row1)
{
$Selected=($row['FSSPTALUKCODE']==$row1['ftalukssp']) ? "selected" : "";
$table .= "<option ".$Selected." value='".$row1['ftalukssp']."'>".$row1['ftalukname']."</option>";
}
$table .= "</select></center></td>";
$table .= "<td><center><select style = 'height:32px;' id='sspcolltype_{$row['college_code']}'>";
$table .= "<option value=''>-Select-</option>";
foreach($colltypearray as $row1)
{
$Selected=($row['FSSPCOLLTYPE']==$row1['fsspcolltype']) ? "selected" : "";
$table .= "<option ".$Selected." value='".$row1['fsspcolltype']."'>".$row1['ffdespn']."</option>";
}
$table .= "</select></center></td>";
//$table .= "<td><input type='text' value='".$row['ssp_code']."' id='sspcollcode_{$row['college_code']}'></td>";
$table .= "<td><button onclick=\"updatedata('".$row['college_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 =='collupd')
{
$sspdegcode=$_POST['sspdegcode'];
$collcode=$_POST['collcode'];
$sspcolltype=$_POST['sspcolltype'];
$ssptalukcode=$_POST['ssptalukcode'];
$sspdistcode=$_POST['sspdistcode'];
$query = "update {$db}.college set fsspcollcode='{$sspdegcode}',
FSSPCOLLTYPE='{$sspcolltype}',
FSSPTALUKCODE='{$ssptalukcode}',
FSSPDISTCODE='{$sspdistcode}'
WHERE fcollcode='{$collcode}'";
$result = mysqli_query($conn, $query);
if($result)
{
echo "Updated Successfully";
}
else
{
echo "Updation failed";
}
}
?>
|