Sunday, 4 September 2016

boolean - PHP Call to a member function execute()

I'm making a form where you can enter your own product and add it to the store (it's a project) but whenever I press on "Add" I keep getting this error message:





Fatal error: Call to a member function execute() on boolean in




$query = "INSERT INTO tbl_product (id, name, image, price, lager, age) VALUES (NULL, :name, :image, :price, :lager, :age)";
$stmt = $mysqli -> prepare($query);

$stmt -> execute(array(
":name" => $name,

":image" => $image,
":price" => $price,
":lager" => $lager,
":age" => $age));


I've checked and all the variables exist and they work, I've tried with echo and so on to check.
Any help is greatly appreciated!

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...