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 : 18.219.248.129
<?php
function kswuomrupd($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select * from studomr";
$result = $aobj_context->pobj_db->GetAll($query);
$upd = "update studomr set fmarks1 = NULL, fmarks2= NULL, fwmarks2 = NULL, fwmarks1 = NULL";
$updres = $aobj_context->pobj_db->Execute($upd);
foreach($result as $val)
{
$fregno = $val['fregno'];
$fomr1 = $val['fomr1'];
$fomr2 = $val['fomr2'];
$query1 = "select s.fregno,s.fomrno,s.fqpno,s.fans,k.fanskey,
sum(if(k.fanskey = s.fans,1,0)) as marks,
sum(if(s.fans = '',0,if(k.fanskey = s.fans,0,1))) as wmarks
from studtran s inner join keyans k on k.fqueno = s.fqpno
and k.fsubcode ='01'
where fregno = '{$fregno}' and fomrno = '{$fomr1}'
and s.fsubcode in('01','02')";
$res1 = $aobj_context->pobj_db->GetRow($query1);
$marks1 = $res1['marks'];
$wmarks1 = $res1['wmarks'];
echo $fregno." - ". $marks1."<br>";
$upd = "update studomr set fmarks1 = '{$marks1}' ,fwmarks1 = '{$wmarks1}'
where fregno = '{$fregno}'
and fomr1 = '{$fomr1}'";
$resupd = $aobj_context->pobj_db->Execute($upd);
$query2 = "select s.fregno,s.fomrno,s.fqpno,s.fans,k.fanskey,
sum(if(k.fanskey = s.fans,1,0)) as marks,
sum(if(s.fans = '',0,if(k.fanskey = s.fans,0,1))) as wmarks
from studtran s inner join keyans k on k.fqueno = s.fqpno
and k.fsubcode ='02'
where fregno = '{$fregno}' and fomrno = '{$fomr2}'
and s.fsubcode in('01','02')";
$res2 = $aobj_context->pobj_db->GetRow($query2);
$marks2 = $res2['marks'];
$wmarks2 = $res2['wmarks'];
$upd2 = "update studomr set fmarks2 = '{$marks2}' , fwmarks2 = '{$wmarks2}'
where fregno = '{$fregno}'
and fomr2 = '{$fomr2}'";
$resupd2 = $aobj_context->pobj_db->Execute($upd2);
echo $fregno." - ". $marks2."<br>";
}
echo "Completed";
}
function omrdataupd($aobj_context)
{
$databse = "logisys3_kswu";
//var_dump(SERVERNAME,USERNAME,PASSWORD,$databse);
$SERVERNAME = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$USERNAME = "admin";
$PASSWORD = "T0g3th3r@all";
//var_dump(PASSWORD);
$conn = new mysqli ("logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com","admin","T0g3th3r@all","logisys3_kswu");
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$z = 1;
for($i=0;$i<100;$i++)
{
$filed = "F".str_pad($z, 3, '0', STR_PAD_LEFT);
$query ="insert ignore into studtran(fregno,fomrno,fsubcode,fqpno,fans)
select fregno,fomrno,fsubcode,'{$filed}',$filed From kswuomrdata";
$res = mysqli_query($conn,$query);
$z++;
}
}
?>
|