I ran into this error:
Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in /storage/ssd5/087/18910087/public_html/admin/connect.php:35 Stack trace: #0 {main} thrown in /storage/ssd5/087/18910087/public_html/admin/connect.php on line 35
I checked my PHP code but I didn't find any error with the names of elements or anything like that
My code:
<?php
$carname = $_POST['carname'];
$year = $_POST['year'];
$manufacturer = $_POST['manufacturer'];
$price = $_POST['price'];
$eco = $_POST['eco'];
$drive = $_POST['drive'];
$cylinder = $_POST['cylinder'];
$desc = $_POST['desc'];
$intName1 = $_POST['intName1'];
$intDesc1 = $_POST['intDesc1'];
$intName2 = $_POST['intName2'];
$intDesc2 = $_POST['intDesc2'];
$intName3 = $_POST['intName3'];
$intDesc3 = $_POST['intDesc3'];
$perName1 = $_POST['perName1'];
$perDesc1 = $_POST['perDesc1'];
$perName2 = $_POST['perName2'];
$perDesc2 = $_POST['perDesc2'];
$extName1 = $_POST['extName1'];
$extDesc1 = $_POST['extDesc1'];
$extName2 = $_POST['extName2'];
$extDesc2 = $_POST['extDesc2'];
$extName3 = $_POST['extName3'];
$extDesc3 = $_POST['extDesc3'];
$id = $_POST['id'];
// Database connection
$conn = new mysqli('localhost','id18910087_admin','@Root2022toor@','id18910087_cars');
if($conn->connect_error){
echo "$conn->connect_error";
die("Connection Failed : ". $conn->connect_error);
} else {
$stmt = $conn->prepare("insert into cars(carname, year, manufacturer, price, eco, drive, cylinder, desc, intName1, intDesc1, intName2, intDesc2, intName3, intDesc3, perName1, perDesc1, perName2, perDesc2, extName1, extDesc1, extName2, extDesc2, extName3, extDesc3, id) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("sisiisisssssssssssssssssi", $carname, $year, $manufacturer, $price, $eco, $drive, $cylinder, $desc, $intName1, $intDesc1, $intName2, $intDesc2, $intName3, $intDesc3, $perName1, $perDesc1, $perName2, $perDesc2, $extName1, $extDesc1, $extName2, $extDesc2, $extName3, $extDesc3, $id);
$execval = $stmt->execute();
echo $execval;
echo "Registration successfully...";
$stmt->close();
$conn->close();
}
?>