include("connAd.php"); //var $CareNumber=$_POST['CareNumber']; $OutIn=$_POST['radio']; $Name=$_POST['Name']; $Position=$_POST['Position']; $Gofor=$_POST['Gofor']; $Att=$_POST['Att']; $TimeStart = $_POST['TimeStart']; $TimeStart2 = $_POST['TimeStart2']; $amount=$_POST['amount']; $ListPeople=$_POST['ListPeople']; $StartCar=$_POST['StartCar']; $timeStartCar =$_POST['timeStartCar']; //int $Depart=$_POST['Depart']; $province_id=$_POST['province_id']; $amphur_id=$_POST['amphur_id']; $district_id=$_POST['district_id']; $DrvCode = $_POST['Driver']; //date $Hdate =$_POST['H_Date']; $StartDateO=$_POST['popup_container']; $EndDateO=$_POST['popup_container2']; $HDateNew = substr($Hdate,7,4)."-".substr($Hdate,4,2)."-".substr($Hdate,1,2); //echo "HDate".$Hdate." new =".$HDateNew; $StartDate = substr($StartDateO,6,4)."-".substr($StartDateO,3,2)."-".substr($StartDateO,0,2); //echo "HDate".$StartDate." new =".$StartDate; $EndDate = substr($EndDateO,6,4)."-".substr($EndDateO,3,2)."-".substr($EndDateO,0,2); //echo "HDate".$EndDate." new =".$EndDate; $sqlM= "SELECT Max(DetailCarID) as MaxID FROM DetailCar"; $resultM = mysql_db_query($dbname,$sqlM) or die ("No Query"); $num=mysql_num_rows($resultM); $dbquery = mysql_query($sqlM); if ($num<>0){ while($resultM = mysql_fetch_array($dbquery)){ $max = $resultM['MaxID']; } $DCarId = $max+1; } else{ $DCarId = 1; } $sql= "insert into DetailCar(DetailCarID,HDate,CarNumber,OutIn,PeoReq,Position,Deptcode,DateStart,TimeStart,DateEnd,TimeEnd,Address,Tumbon,Aumphur,Provinc,AmountPeo,ListPeo,StartCar,TimeStartCar,DriverCode,UseFor)VALUES($DCarId,'$HDateNew','$CareNumber','$OutIn','$Name','$Position',$Depart,'$StartDate','$TimeStart','$EndDate','$TimeStart2','$Att',$district_id,$amphur_id,$province_id,'$amount','$ListPeople','$StartCar','$timeStartCar',$DrvCode,'$Gofor')"; // echo "Sql ==>".$sql; ?>
แบบขออนุมัติใช้รถยนต์ | ||
---|---|---|
$dbqueryInsert=mysql_query($sql);
if($dbqueryInsert){
echo "บันทึกข้อมูลเรียบร้อยแล้ว OK "; } else{ echo "ไม่สามารถบันทึกข้อมูลได้ <<ย้อนกลับ"; } ?> |