File size: 1,444 Bytes
ff9ae2f | 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 | ```php
<?php
$id = $_GET['id'] ?? 0;
try {
$conn = new PDO("mysql:host=localhost;dbname=bhbm_service", "username", "password");
$stmt = $conn->prepare("DELETE FROM service_records WHERE id = ?");
$stmt->execute([$id]);
header("Location: service_records.php");
exit();
} catch(PDOException $e) {
die("Database error: " . $e->getMessage());
}
?>
```
You'll also need to create these database tables:
```sql
CREATE DATABASE bhbm_service;
CREATE TABLE service_records (
id INT AUTO_INCREMENT PRIMARY KEY,
client_name VARCHAR(100) NOT NULL,
contact_number VARCHAR(20) NOT NULL,
equipment_type VARCHAR(50) NOT NULL,
brand VARCHAR(50) NOT NULL,
serial_number VARCHAR(50),
issue_description TEXT NOT NULL,
service_date DATE NOT NULL,
technician VARCHAR(50) NOT NULL,
service_notes TEXT,
status VARCHAR(20) DEFAULT 'Completed',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE service_requests (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(100) NOT NULL,
customer_email VARCHAR(100) NOT NULL,
customer_phone VARCHAR(20) NOT NULL,
customer_company VARCHAR(100),
equipment_type VARCHAR(50) NOT NULL,
brand VARCHAR(50) NOT NULL,
model VARCHAR(50),
issue_description TEXT NOT NULL,
contact_method VARCHAR(20) NOT NULL,
status VARCHAR(20) DEFAULT 'New',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
``` |