$sql = 'INSERT INTO comments(name, comment, post_id) VALUES (:name, :comment, :post_id)';
$sqlParams = [':name' => $_POST['name'], ':comment' => $_POST['comment'], ':post_id' => $_GET['id']];
$sql = 'SELECT * FROM comments WHERE post_id = :id';
$sqlParams = [':id' => $_GET['id']];
class Registration {
protected $connection;
public function __construct() {
$this->connection = Db::Connect();
}
public function Registr() {
if(isset($_POST['btn'])) {
if(isset($_POST['email']) !== '' && isset($_POST['login']) !== '' && isset($_POST['password']) !== '') {
$dbh = $this->connection;
$sql = 'INSERT INTO users(email, login, password) VALUES (:email, :login, :password)';
$sqlParams = [':email' => $_POST['email'], ':login' => $_POST['login'], ':password' => $_POST['password']];
$sth = $dbh->prepare($sql);
$sth->execute($sqlParams);
header('Location: /');
} else {
echo 'Заполните все поля <a href="../View/registration.php"><b>Registration</b></a>';
}
}
}
}