Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mysqli = new MySQLi('localhost', 'root', '11111', 'CAR_PARKING_SYSTEM');
- $sql = <<< SQL
- INSERT INTO `CUSTOMER_VEHICLE` (
- `V_License_No`,
- `D_License_No`,
- `Arrived_Time`,
- `Charge`
- ) VALUES (
- ?, ?, ?, ?
- );
- SQL;
- $stmt = $mysqli->prepare($sql);
- if ($stmt === false) {
- die('Could not prepare SQL: '.$mysqli->error);
- }
- $ok = $stmt->bind_param('sssi', $vLicense, $dLicense, $arrived, $charge);
- if ($ok === false) {
- die('Could not bind params: '.$stmt->error);
- }
- $vLicense = filter_input(INPUT_POST, 'V_License_No', FILTER_SANITIZE_STRING);
- $dLicense = filter_input(INPUT_POST, 'D_License_No', FILTER_SANITIZE_STRING);
- $arrived = date('H:i');
- if (isset($_POST['vehicle_type']) && $_POST['vehicle_type'] === 'four_wheel') {
- $charge = 50;
- } else {
- $charge = 400;
- }
- if ($stmt->execute() === false) {
- die('Could not execute query: '.$stmt->error);
- } else {
- echo '<p>Query executed successfully!</p>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement