1

I'm editing the question::: What is wrong with my save function.It's give a "Call to a member function bind_param() on a non-object error" in second line in save method.

public function __construct()
{   
$this->lastResult=null;
global $loader;
$this->_dbConfig = $loader->getConfig('database');

if(Env == 'development')

{
    $dbcon=$this->_dbConfig['local'];

}
else
{
    $dbcon=$this->_dbConfig['global'];

}
$con=mysqli_connect($dbcon['servername'],       $dbcon['username'],$dbcon['password'],$dbcon['databasename']);

$this->mysqli=$con;
if (mysqli_connect_errno())
{
throw new Exception("Failed to connect to MySQL: " . mysqli_connect_error(), 1);
}
}
                                                                       //This is my save method for inserting value dynamically
public function save($data,$data1)
{ 
$insert=$this->mysqli->prepare("insert into $this->tbl1(test1,test2)      values (?,?)");//giving error in this line.
$insert->bind_param('is',$data,$data1);
$insert->execute();
$insert->close();

}

Navid
  • 187
  • 1
  • 17

0 Answers0