php - Catchable fatal error: Object of class PDOStatement could not be converted to string on line 10 -
i'm still getting error when registering new account
catchable fatal error: object of class pdostatement not converted string on line 10
class user { var $name = ""; var $email = ""; var $user_id; function __construct($user_id) { global $pdo; $this->user_id = $user_id; $user_info = $pdo->prepare("select * users user_id = :id"); $user_info->execute(array(":id" => $user_id)); $result = $user_info->fetch(pdo::fetch_assoc); $this->email = $result["email"]; $this->name = $result["name"]; } public static function createuser($email,$password,$name) { global $pdo; $check = $pdo->prepare("select user_id users email = ?"); $check->execute(array($email)); $stmt = $check->fetch(); if(isset($stmt["user_id"])) { return false; } $password_hash = hash('sha256', $password); $user_id = $pdo->prepare("insert users (email, password, name) values (?,?,?)"); $user_id->execute(array( $email, $password_hash, $name)); return new user($user_id); } }
can me?
Comments
Post a Comment