Call to a member function prepare() on a non-object


<?php include_once('class.database.php'); class manageuser { public $con; function __construct() { $dbconnection=new dbconnection(); $this->con=$dbconnection->connect(); return $this->con; } function rigesteruser($name,$email,$password,$phonenumber,$text) { $query=$this->con->prepare("INSERT INTO users(name,email,password,phonenumber,text)VALUES(?,?,?,?,?)"); $values=array($name,$email,$password,$phonenumber,$text); $query->excute($values); $counts=$query->rowCount(); return $counts; } } $users=new manageuser(); echo $users->rigesteruser('boob','boob','boob','95544522','hey this test'); ?>

You should check for errors on the db connect

oh yes i found an error in the connect to database code . thanks a lot Jim .

Sponsor our Newsletter | Privacy Policy | Terms of Service