The column test_int is an integer
however when I execute the below query it shows successful.
I wonder how it can be successful because I am entering a string $id = "tett";
I think it should not execute the query because the data type does not match.
<?php
include('db_connect.php');
// Prepare an insert statement
$sql = "INSERT INTO admin (test_int, username, password, maname) VALUES (?, ?, ?, ?)";
if($stmt = mysqli_prepare($con, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "isss", $id, $username, $password, $maname);
// Set parameters
$id = "tett";
$username = "New username";//$_REQUEST['first_name'];
$password = "New password";//$_REQUEST['last_name'];
$maname = "New Name";//$_REQUEST['email'];
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not execute query: $sql. " . mysqli_error($con);
}
} else{
echo "ERROR: Could not prepare query: $sql. " . mysqli_error($con);
}
// Close statement
mysqli_stmt_close($stmt);
// Close connection
mysqli_close($con);