Initial commit with updated Auth and media ignored
This commit is contained in:
33
serviceapp/addWelcomeDriverNote.php
Normal file
33
serviceapp/addWelcomeDriverNote.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../connect.php';
|
||||
|
||||
// Sanitize and retrieve input parameters
|
||||
$driverId = filterRequest("driverId");
|
||||
$notes = filterRequest("notes");
|
||||
|
||||
// SQL: Insert or Update if already exists
|
||||
$sql = "INSERT INTO `welcomeDriverCall` (`driverId`, `isCall`, `notes`)
|
||||
VALUES (:driverId, '1', :notes)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`isCall` = '1',
|
||||
`notes` = VALUES(`notes`),
|
||||
`createdAt` = NOW()";
|
||||
|
||||
// Prepare the statement
|
||||
$stmt = $con->prepare($sql);
|
||||
|
||||
// Bind parameters
|
||||
$stmt->bindParam(':driverId', $driverId);
|
||||
$stmt->bindParam(':notes', $notes);
|
||||
|
||||
// Execute the statement
|
||||
$success = $stmt->execute();
|
||||
|
||||
if ($success) {
|
||||
jsonSuccess(null, "Record inserted/updated successfully");
|
||||
} else {
|
||||
jsonError("Failed to insert or update record");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user