-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_customer.php
More file actions
53 lines (44 loc) · 1.51 KB
/
update_customer.php
File metadata and controls
53 lines (44 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header("Location: login.php");
exit();
}
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "demo";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Bağlantı hatası: " . $conn->connect_error);
}
$response = array();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$customerID = $_POST['id'];
$f_ad = $_POST['f_ad'];
$f_adres = $_POST['f_adres'];
$f_yetkili = $_POST['f_yetkili'];
$f_website = $_POST['f_website'];
$f_eposta = $_POST['f_eposta'];
$f_tel = $_POST['f_tel'];
$f_fatura_adres = $_POST['f_fatura_adres'];
$f_vergid = $_POST['f_vergid'];
$f_vergino = $_POST['f_vergino'];
$f_refererans = $_POST['f_refererans'];
$sql = "UPDATE customers SET f_ad=?, f_adres=?, f_yetkili=?, f_website=?, f_eposta=?, f_tel=?, f_fatura_adres=?, f_vergid=?, f_vergino=?, f_refererans=? WHERE id=?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssssssssssi", $f_ad, $f_adres, $f_yetkili, $f_website, $f_eposta, $f_tel, $f_fatura_adres, $f_vergid, $f_vergino, $f_refererans, $customerID);
if ($stmt->execute()) {
$response['success'] = true;
} else {
$response['success'] = false;
$response['error'] = $conn->error;
}
$stmt->close();
} else {
$response['success'] = false;
$response['error'] = "Invalid request method.";
}
$conn->close();
echo json_encode($response);
?>