i created a application form and it has application no field. but it should be hidden. this application no should be auto increment unique number. i use date() and mysql_insert_id() method to generate that. but always show 0 value in my table. i have posted my code. please anyone can explain me..what is the error..about this case. this code is successfully inseterd. but did not show correct output. always show 0
if(isset($_POST['submitted'])){
// catch data
$loantype = $_POST['loantype'];
$calcno = $_POST['calcno'];
$memberid = $_POST['memberid'];
$appno = date('Y-m-d')."-LN/SS-".mysql_insert_id();
$amount = $_POST['amount'];
$rental_type = $_POST['rental_type'];
$apr = $_POST['apr'];
$npy = $_POST['npy'];
$flatrate = $_POST['flatRate'];
$othercharges = $_POST['othercharges'];
$repayment = $_POST['Repayment'];
$payment = $_POST['payment'];
$totpaid = $_POST['totpaid'];
$intpaid = $_POST['intpaid'];
date_default_timezone_set("Asia/Calcutta");
$created = date('Y-m-d h:i:s');
$status = "PENDING";
$discription = "NOT DEFINED";
$accepted_amount = "NOT DEFINED";
//create new loan application
$sql ='INSERT INTO tbl_loan_application VALUES (NULL,"'.$loantype.'","'.$calcno.'","'.$memberid.'","'.$appno.'","'.$amount.'","'.$rental_type.'","'.$apr.'","'.$npy.'","'.$flatrate.'","'.$othercharges.'","'.$repayment.'",
"'.$created.'","'.$status.'","'.$discription.'","'.$accepted_amount.'","'.$payment.'","'.$totpaid.'","'.$intpaid.'")';
/*else{
}*/
mysql_query($sql, $conn) or die(mysql_error());
echo'<div class="alert alert-dsgn alert-success fade in" style="width:400px; align:center; margin-left:35%; margin-top:5px;>
<button class="close" aria-hidden="true" data-dismiss="alert" type="button"></button>
<i class="fa fa-thumbs-up fa-3x"></i>
<article>
<h4>Nice! </h4>
<p>New Loan application successfully saved..<br /> </p>
</article>
</div>';
echo '<a href="newloan.php"><p align="center">Back</p></a>';
echo '<p align="center">If you want to view loan application! click <a href="approved_loan_list.php">here</a></p>';
echo mysql_insert_id();
die();
//
}