Access Denied Error for MySQLi Connection on Local Machine
I’m encountering an issue with my PHP code that involves connecting to a MySQL database using MySQLi. The error message I’m getting is:
Trying to access array offset on value of type null in C:xampphtdocs1_V4initmodelclass_model.php on line 36
public function login_admin($username, $password)
{
$stmt = $this->conn->prepare(“SELECT * FROM gym_staff
WHERE username
= ? AND password
= ?”) or die($this->conn->error);
$stmt->bind_param(“ss”, $username, $password);
if ($stmt->execute()) {
$result = $stmt->get_result();
$valid = $result->num_rows;
$fetch = $result->fetch_array();
echo htmlentities($fetch[‘id_gym_staff’]);
return array(