This project ran smoothly before, and I already hosted it on heroku. When I try to download the source code and run the project locally, it throws some errors. The first error is:
[Fri May 26 17:08:01 2023] [::1]:49688 [200]: POST /Admin/reg_StoreManager.php - Uncaught Error: Call to a member function execute() on bool in C:\xampp\htdocs\s51914-dzihniboutique\Admin\reg_StoreManager.php:34 Stack trace: #0 {main} thrown in C:\xampp\htdocs\s51914-dzihniboutique\Admin\reg_StoreManager.php on line 34
Here is the code:
/Admin/reg_StoreManager.php
<?php
error_reporting(0);
include_once '../database.php';
include_once 'session.php';
session_start();
?>
<?php
if (isset($_POST['reg_StoreManager'])) {
try {
$stmt = $conn->prepare("INSERT INTO storemanager(StoreManagerFullName, StoreManagerName,
StoreManagerPass, StoreManagerEmail,StoreManagerPhone, StoreManagerAddress) VALUES(?,?,?,?,?,?)");
// //$stmt->bindParam(':outsider_id', $outsider_id, PDO::PARAM_STR);
// $stmt->bindParam(':StoreManagerFullName', $StoreManagerFullName, PDO::PARAM_STR);
// $stmt->bindParam(':StoreManagerName', $StoreManagerName, PDO::PARAM_STR);
// $stmt->bindParam(':StoreManagerPass', $StoreManagerPass, PDO::PARAM_STR);
// $stmt->bindParam(':StoreManagerEmail', $StoreManagerEmail, PDO::PARAM_STR);
// $stmt->bindParam(':StoreManagerPhone', $StoreManagerPhone, PDO::PARAM_STR);
// $stmt->bindParam(':StoreManagerAddress', $StoreManagerAddress, PDO::PARAM_STR);
//$outsider_id = $_POST['outsider_id'];
// $StoreManagerFullName = $_POST['StoreManagerFullName'];
// $StoreManagerName = $_POST['StoreManagerName'];
// $StoreManagerPass = md5($_POST['StoreManagerPass']);
// $StoreManagerEmail = $_POST['StoreManagerEmail'];
// $StoreManagerPhone = $_POST['StoreManagerPhone'];
// $StoreManagerAddress = $_POST['StoreManagerAddress'];
// $stmt->bind_param("ssssss", $s_name, $username, $s_pass, $s_email, $s_phone, $s_address);
$stmt->execute();
echo '<script type="text/javascript">';
echo 'alert("New Account has been registered!");';
echo 'window.location.href = "RegisterStoreManager.php";';
echo '</script>';
//header('Location: RegisterStoreManager.php');
}
catch(PDOException $e)
{
echo "Error: " . $e->getMessage();
}
}
?>
echo '<script type="text/javascript">';
echo 'alert("New Account has been registered!");';
echo 'window.location.href = "RegisterStoreManager.php";';
echo '</script>';
// header('Location: RegisterStoreManager.php');
}
Line 34 is $stmt->execute();