<?php

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

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

$maindb = 'driver2';
$trandb = 'accmast';
$myyear = $_SESSION[$myyear];



$result = mysqli_query($conn, "SELECT * FROM $maindb WHERE `accode` != ''") or die(mysqli_error($conn));

$getnum = mysqli_num_rows($result);
//browse($getnum);
while($get = mysqli_fetch_array($result)){
    $code = $get["accode"];
    $grpcode = $get["grpcode"];
    $name = $get["name"];
    $add1 = $get["add1"];
    $add2 = $get["add2"];
    $add3 = $get["add3"];
    $custcode = $get["custcode"];
    $city = $get["city"];
    $pin = $get["pin"];
    $country = $get["country"];
    $station = $get["station"];
    $tel = $get["tel"];
    
//browse($code);    
mysqli_query($conn, "INSERT INTO $trandb (`accode`, `grpcode`, `init`, `name`, `add1`, `add2`, `add3`, `custcode`,  `city`, `pin`,`country`,`station`,`tel`)
                           VALUES($code, '$grpcode', 'DF', '$name', '$add1', '$add2', '$add3', '$custcode',  '$city', '$pin','$country','$station','$tel')") or die(mysqli_error($conn));

//browse("2");
}
browse("success");
?>
