|
|
|
ขอสอบถามการเช็คค่าซ้ำก่อนบันทึกข้อมูล ของ PHP sqlsrv ครับ |
|
|
|
|
|
|
|
Code (PHP)
$sql = "INSERT INTO RFID_Master (
EmpID, RFIDNo, Status,
CreatedBy, CreatedDate) VALUES (?, ?, ?, ?, ? )";
$params = array($_POST["txtempID"], $_POST["txtRFID"], "1", $_POST["txtCreator"], $_POST["txtCdate"]);
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
echo "<script type=text/javascript>alert('Unsuccessful error!');javascript:history.back(1);</script>";
exit();
}
else
{
echo "<script type=text/javascript>alert('Successfully Record');javascript:history.back(1);</script>";
exit();
}
ขอโค้ดตัวอย่างหน่อยนะครับ
Tag : PHP, Ms SQL Server 2016, JavaScript, Ajax, jQuery, XAMPP
|
ประวัติการแก้ไข 2019-06-05 10:29:01
|
|
|
|
|
Date :
2019-06-05 10:28:42 |
By :
มือใหม่ |
View :
799 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$num_rows = sqlsrv_num_rows($stmt);
|
|
|
|
|
Date :
2019-06-05 12:54:46 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|