PHP Fatal error: Declaration of ...MySQLServer::insert() must be compatible with ...Server::insert() in /home/lfLvpx/prog.php on line 102
Почему возникает эта ошибка, и как ее поправить?
abstract class Server
{
public function __construct($token)
{
if ($token !== $_POST['crm_token']) {
http_response_code(401);
} else {
$this->accept();
}
}
abstract protected function insert();
...
}
class MySQLServer extends Server
{
protected function insert(mysqli $link, $table, array $required)
{
$fields = "`".implode("`, `", $required)."`";
$fields_num = count( $required );
$questions = str_repeat( "?,", $fields_num - 1 ) . "?";
$query = "INSERT INTO `$table` ($fields) VALUES ($questions)";
$data = [];
foreach( $required as $field ){
$data[] = $_POST[$field];
}
$stmt = mysqli_prepare($link, $query );
$types = str_repeat('s', $fields_num );
$stmt->bind_param( $types, ...$data );
$stmt->execute();
}
}
abstract protected function prefixName($name);
и ребенокpublic function prefixName($name, $separator = ".")
.....но что-то мне подсказывает они у вас все обязательные