A
A
Almaz Familia2021-07-08 21:51:17
PHP
Almaz Familia, 2021-07-08 21:51:17

Error adding to database?

Do not enter any text with an error, it is simply not added to the database

$dsn = 'mysql:host=localhost;dbname=prpr';
$pdo = new PDO($dsn , 'root', '');
  $title = $_POST['title'];
  $txt = $_POST['txt'];
  $sel = $_POST['sel'];
  $sql = "INSERT INTO forum(title,txt,sel) VALUES(:title,:txt,:sel)";
  $query = $pdo->prepare($sql);
  $query->execute(['title' => $title, 'txt' => $txt, 'sel' => $sel]);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question