Friday, 20 September 2019

Approval files

Hi all,

See the files associated with approval.


-------------------------------------
adminhome.php

<html>
<body>
<a href='approvestudent.php'>Approve student</a><br>
<a href='approvefaculty.php'>Approve faculty</a><br>
</body>
</html>

------------------------------------
approvestudent.php
----------------------------------
<?php
include('dbconnect.php');

$query = "select * from login where type='student' and

status='0'";
$result = mysql_query($query);
if (!$result)
{
 $message = 'ERROR:' . mysql_error();
 return $message;
}
else
{
 $i = 0;
 echo '<html><body><table border=1 align=center><tr>';
 while ($i < mysql_num_fields($result))
 {
  $meta = mysql_fetch_field($result, $i);
  echo '<th>' . ucfirst($meta->name) . '</th>';
  $i = $i + 1;
 }
 echo '<th>Approve</th><th>Delete</th></tr>';
 $i = 0;
 while ($row = mysql_fetch_row($result))
 {
  echo '<tr>';
  $count = count($row);
  $y = 0;
  $idval='1';
  while ($y < $count)
  {
   $c_row = current($row);
   if($y==0)
    $idval=$c_row;
if($y==1)
    $c_row="****";
   echo '<td>' . $c_row . '</td>';
   next($row);
   $y = $y + 1;
  }
  echo '<td><a href=approvestudent1.php?id='.

$idval.'>Approve</a></td><td><a href=deletestudent.php?id='.

$idval.'>Delete</a></td>';
  echo '</tr>';
  $i = $i + 1;
 }
 echo '</table></body></html>';
 mysql_free_result($result);
}
mysql_close ($con);

?>
----------------------------------------
approvestudent1.php
--------------------
<?php
include('dbconnect.php');
$id=$_GET['id'];
$qr="update login set status='1' where username='$id'";
mysql_query($qr,$con);
header("location:approvestudent.php");



?>
--------------------------
deletestudent.php
---------------------
<?php
include('dbconnect.php');
$id=$_GET['id'];
$qr="delete from login where username='$id'";
mysql_query($qr,$con);
header("location:approvestudent.php");



?>

No comments:

Post a Comment