<?php

ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$maindb = "demdmain";
$trandb = 'demdtran';


$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

$getpmain = mysqli_query($conn, "SELECT * FROM `demdmain` WHERE session = 'A' and section = 'P' and examcode = 15 order by vouchno") or die(mysqli_error($conn));

while ($row = mysqli_fetch_array($getpmain)) {
    $vouchno = $row['vouchno'];

    mysqli_query($conn, "Delete FROM `$trandb` WHERE `vouchno`='$vouchno'") or die(mysqli_error($conn));
    mysqli_query($conn, "Delete FROM `$maindb` WHERE `vouchno`='$vouchno'") or die(mysqli_error($conn));



//      mysqli_query($conn, "update `$maindb` set nopack = '$nofpack' WHERE `vouchno` = '$vouchno' and year = '$myyear'") or die(mysqli_error($conn));
}
browse('done');

