-1

I have been trying to do a DELETE statement and i even tried running the query in MySQL workbench and everything was ok but in my service it does't seem to accept it.

      $statement_delete = $this->conn->prepare("DELETE FROM crm_suite_tcl.aos_products_quotes where parent_id = ?");
       $statement_delete->bind_param("s", $id_pedido);

       $statement_delete->execute();
       $resultado_borrar_lineas = $statement_delete->get_result();

It throws that the statement is false, so it doesn't let me execute it Fatal error: Call to a member function bind_param() on boolean in

Fatal error: Call to a member function bind_param() on boolean in C:\xampp2\htdocs\crm\service\sync\include\db_handler.php on line 210
Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

The error you are getting basically means that your statement cannot be prepared most likely due to a syntax error (a column or table that doesn't exist).

Try adding in your code:

if(!$statement_delete){
   error_log($this->conn->error);
}

This should write the error to the console and you will be able to correct it.

  • Please do not check manually for errors. OP is using a framework which already has a database class and a logger. You should avail of best practices instead of manually checking for errors after each line of code. – Dharman Apr 22 '20 at 19:25