0
protected function checkUser($name){
   $sql = "SELECT * FROM users WHERE users_name = ? ;";
   $stmt = mysqli_stmt_init($this->connect);

    if (!mysqli_stmt_prepare ($stmt,$sql)){
        header("location: ../index.php?error=stmtfailed2");
        exit();
    }

    

    


    mysqli_stmt_bind_param($stmt, "s", $name);

    mysqli_stmt_execute($stmt);

    $outcomeData = mysqli_stmt_get_result($stmt);

    if ($row = mysqli_fetch_assoc($outcomeData)){
        return $row;

    }
    else{
        $result = false;
        return $result;
    }

    mysqli_stmt_close($stmt);
}

My statement keeps on failing and I don't know why.

It might be my connection to the data base so here it is

protected function estabConnect()
{

    $host = 'localhost';
    $username = 'root';
    $password = 'root';
    $dbname = 'EspressoMAtes'; // it is suppose to have those capitals

    $connect = mysqli_connect($host, $username, $password, $dbname);

    if (!$connect) {
        die("Connection faild: " . mysqli_connect_error());
    }
}
Dharman
  • 30,962
  • 25
  • 85
  • 135

0 Answers0