 |
|
รบกวนสอบถามวิธีการ insert ข้อมูลลงตาราง
Code (PHP)
<php
$staff_id= $_POST["staff_id"];
$Qstatus= $_POST["queue_status"];
$Date= $_POST["travel_date_id"];
$Qnum= $_POST["queue_number"];
$time= $_POST["departure_time"];
$strSQL = "INSERT INTO `van_queue`(`id`, `staff_id`, `travel_date_id`, `queue_number`, `departure_time`, `queue_status`)
VALUES (NULL,'$staff_id','$Date','$Qnum','$time','$Qstatus')";
/*** Insert ***/
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
$arr['StatusID'] = "0";
$arr['Error'] = "Cannot save data!";
}
else
{
$arr['StatusID'] = "1";
$arr['Error'] = "Save";
}
/**
$arr['StatusID'] // (0=Failed , 1=Complete)
$arr['Error'] // Error Message
*/
mysql_close($objConnect);
echo json_encode($arr);
?>
พอเปลี่ยนเป็น ตัวแปรที่ใช้post มันinsert ข้อมูลลงไม่ได้ ไม่แน่ใจว่าเขียนอะไรผิดตรงไหน
รบกวนแนะวิธีให้หน่อยนะคะ
Tag : PHP, MySQL, Ms SQL Server 2005, Ms SQL Server 2008, Android
|
|
 |
 |
 |
 |
Date :
2016-12-04 22:22:32 |
By :
pikpluss |
View :
723 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |