Why swear?

Recently started to understand the PLO and was immediately faced with the problem
Fatal error: Uncaught Error: Call to undefined function add_in_db() in E:\OSPanel\domains\tutorial\index.php:7 Stack trace: #0 {main} thrown in E:\OSPanel\domains\tutorial\index.php on line 7

Here is the code index.php
 require_once __DIR__ . '/src/' . $className . '.php';

$add = new Project\Model\Task\BD();

Here the class file BD.php
namespace Project\Model\Task;

class BD{
 public $pdo;
 public function add_in_db($task, $table)
 $this->pdo = new PDO('mysql:host=localhost; dbname=listask', 'root', ");
 $query = $pdo->prepare("INSERT INTO $table(task) VALUES(?)");
 public function delete_from_db($id)
 $query = $pdo->prepare("DELETE FROM tasks WHERE id = ? ");

What's the problem? And how to solve it?
April 19th 20 at 12:48
2 answers
April 19th 20 at 12:50
The error means that the constant contains an incorrect operation. Probably talking about PD0. Are you sure you need that constant? Then why did you pass her the result of some computation with the parameters? Maybe it should not be a constant?
a little about I changed the code now to another swears) - harvey82 commented on April 19th 20 at 12:53
Responsible, you at least looked at the code, no? Obvious mistake has not seen?

$add = new Project\Model\Task\BD();

UPD: TC, it appears, changed the question. Then I apologize to meet. - Pablo_Parisian commented on April 19th 20 at 12:56
April 19th 20 at 12:52
But the error would, in any case, because with this method call will not be transferred to the required parameters, in particular $task, $table
and indeed when all hands, except for null that does not receive, the method returns nothing - Sylvan.Ro commented on April 19th 20 at 12:55

Find more questions by tags OOPPHP