<?php

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

$zdb = $_SESSION["zdbyear_$dbname"];
mysqli_select_db($conn, $zdb);

if ($_REQUEST["code"]) {
    $code = $_REQUEST["code"];

    $genlist2 = mysqli_query($conn, "SELECT MAX(ordno) AS maxord FROM `ordmain` WHERE party = '$code' LIMIT 0,1 ") or die(mysqli_error($conn));
    if (mysqli_num_rows($genlist2) > 0) {
        $vlist2 = mysqli_fetch_assoc($genlist2);
        $plist2 = $vlist2["maxord"] + 1;
    } else {
        $plist2 = '1';
    }
    echo $plist2;
}
?>
