i know this has been posted many many times but ive been searching everything and looking over old posts but i still cannot figure this out and why it keeps reading it as non object heres my code
<?php
require 'dbconfig.php';
class USER
{
private $db;
function __construct($DB_con)
{
$this->db = $DB_con;
}
public function register($fname,$lname,$uname,$umail,$upass,$utitle)
{
try
{
$new_password = MD5($upass);
$stmt = $this->db->prepare("INSERT INTO users(user_name,user_email,user_pass,user_title)
VALUES(:uname, :umail, :upass, :utitle)");
$stmt->bindparam(":uname", $uname);
$stmt->bindparam(":umail", $umail);
$stmt->bindparam(":upass", $new_password);
$stmt->bindparam(":utitle", $utitle);
$stmt->execute();
return $stmt;
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}
public function login($uname,$umail,$upass)
{
try
{
$stmt = $this->db->prepare("SELECT * FROM users WHERE user_name=:uname OR user_email=:umail LIMIT 1");
$stmt->execute(array(':uname'=>$uname, ':umail'=>$umail));
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
if($stmt->rowCount() > 0)
{
if($userRow['user_pass']==MD5($upass))
{
$_SESSION['user_session'] = $userRow['user_id'];
return true;
}
else
{
return false;
}
}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}
public function is_loggedin()
{
if(isset($_SESSION['user_session']))
{
return true;
}
}
public function redirect($url)
{
header("Location: $url");
}
public function logout()
{
session_destroy();
unset($_SESSION['user_session']);
return true;
}
}
/* SHOUTBOX FUNCTIONS */
function getShouts( $limit )
{
global $DB_con, $db_table_prefix;
$stmt = $DB_con->prepare("SELECT userid, shout FROM shouts WHERE userid=:userid AND shout=:shout id LIMIT ?");
$stmt->bind_param("i", $limit);
$stmt->execute(array(':userid'=>$userid, ':shout'=>$shout));
$stmt->bind_result($userid, $shout);
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
$stmt->close();
return ($userRow);
}
function sendShout( $uid, $shout ){
global $DB_con, $db_table_prefix;
$uid = html_sanitize($uid);
$shout = html_sanitize($shout);
if($shout == "/prune")
{
$mysqli->query("TRUNCATE TABLE shouts");
}
$stmt = $DB_con->prepare("INSERT INTO shouts
(userid,shout)
VALUES (?,?)");
$stmt->bind_param("is", $uid, $shout);
$stmt->execute();
$stmt->close();
}
?>
my error is reading on line #87 i cant see what im doing wrong here