car hire web based systems
The web based car hire sonko car company when i insert data, message error comes saying registration failed try again. any one understand the source of that error? please help me or someone who developed the system.
<?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "edit_query_pdo"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { } $sql = "UPDATE tbl_registration SET first_name='Sarah' WHERE tbl_registration_id=2"; if ($conn->query($sql) === TRUE) { echo "Record updated successfully"; } else { echo "Error updating record: " . $conn->error; } $conn->close(); ?>
<?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "edit_query_pdo"; // Create connection // Check connection if (!$conn) { } $sql = "UPDATE tbl_registration SET first_name='Sarah' WHERE tbl_registration_id=2"; echo "Record updated successfully"; } else { } ?>
<?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "edit_query_pdo"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "UPDATE tbl_registration SET first_name='Sarah' WHERE tbl_registration_id=2"; // Prepare statement $stmt = $conn->prepare($sql); // execute the query $stmt->execute(); // echo a message to say the UPDATE succeeded echo $stmt->rowCount() . " records UPDATED successfully"; } catch(PDOException $e) { echo $sql . "<br>" . $e->getMessage(); } $conn = null; ?>
<?php include 'connection.php'; $get_id=$_REQUEST['tbl_registration_id']; $first_name= $_POST['first_name']; $middle_name= $_POST['middle_name']; $last_name= $_POST['last_name']; $email= $_POST['email']; $contact_number= $_POST['contact_number']; $sql = "UPDATE tbl_registration SET first_name ='$first_name', middle_name ='$middle_name', last_name ='$last_name', email ='$email', contact_number ='$contact_number' WHERE tbl_registration_id = '$get_id' "; echo "<script>alert('Successfully Edit The Account!'); window.location='index.php'</script>"; ?>