ok
Direktori : /home/ngwcolle/www/LIBRARY-NGWC/admin/ajax/ |
Current File : /home/ngwcolle/www/LIBRARY-NGWC/admin/ajax/getbarcodeold.php |
<?php // session_start(); error_reporting(0); // include('../includes/config.php'); include('../includes/config.php'); if(isset($_POST["booktype_id"])){ $subid=!empty($_POST['secid'])?$_POST['secid']:''; $booktype=!empty($_POST['booktype_id'])?$_POST['booktype_id']:''; $course_id=!empty($_POST['cat_id'])?$_POST['cat_id']:''; $result_explode = explode('|', $course_id); $cat_name= $result_explode[0]; $cat_code= $result_explode[1]; $resultuser = mysqli_query($con,"SELECT * FROM tbl_book where subject = '$cat_code' and booktype='$booktype'"); $rows = mysqli_num_rows($resultuser); $barcode=$booktype.$cat_name.str_pad((($rows)+1),4,'0',STR_PAD_LEFT); $accession = mysqli_query($con,"SELECT * FROM tbl_book where booktype='$booktype'"); $rowacc = mysqli_num_rows($accession); //$rowacc=$rowacc+13669; if($rowacc>=13669) { $accessionno=0; } else { //$accessionno=$rowacc; $accessionno="NGWC".$cat_name.$booktype.str_pad((($rowacc)+1),4,'0',STR_PAD_LEFT); } $data = array( "barcode" => $barcode, //"result" => $count "accession"=> $accessionno // "fee" => $rowd['cfee'] ); echo json_encode($data); } ?>