I just switched over my project files to my web host (it works perfectly locally).
I’m getting this error, Fatal error: Exception thrown without a stack frame in Unknown on line 0.
It is oh so helpful. I am only including one file right now, it’s a class with one function which counts the IDs of the entered username and password and then either returns true or false depending on what it found. (1 = true, anything but 1 = false).
I’m using PDO (mysql), and if I don’t connect to my database I don’t get the error but if I remove the session_start(); from the top of my document I also don’t get the error. So I’m almost 100% sure that it has something to do with the session. I am running PHP Version 5.2.17.
[php]private $db;
public function __construct() {
$this->db = new PDO(“mysql:host=127.0.0.1;dbname=dbname;”, “user”, “pass”);
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
[/php]
And this is where I set the session,
[php]if(isset($_POST[“submit”])) {
$errors = array();
if($user->login($_POST[“user”], $_POST[“pass”]) === false) {
$errors[] = “Username or password is incorrect”;
}
if(empty($errors)) {
$_SESSION[“user”] = $_POST[“user”];
header(“Location: index.php”);
}
}
[/php]
And this is my login function
[php]public function login($user, $pass) {
$sql = $this->db->prepare(“SELECT COUNT(id
) FROM users
WHERE username
= :user AND password
= :pass”);
$sql->bindParam(":user", $user);
$sql->bindParam(":pass", $pass);
$sql->execute();
return ($sql->fetchColumn() == 1) ? true : false;
}[/php]