There is a connection between two tables, the id value in the lobby table should be passed to the id cell, already in the message table. Here is the structure of two tables:
messages : 
lobby : 
And when I enter a message in the form, the first message for the lobby is added to the database and displayed on the screen, and when I enter the second, nothing is entered into the database and an error appears:
Problem with SQL: INSERT INTO messages (id, message1) VALUES (176, \ 'my text \')
Here is the code that adds to the database:
<?php require_once 'config.php'; $message = FormChars($_POST['message']); // Получаем форму $db->query('SELECT * FROM lobby'); // Получаем id нашего lobby ... $data = $db->Get(); foreach ($data as $key => $value) { $lobby_id = $value['id']; // ... Получили } // Вносим в таблицу messages - id нашего лобби и само сообщение $db->Query("INSERT INTO messages(id, message1) VALUES ($lobby_id, '$message')"); echo $message; ?> I would be very grateful if someone responds ...
WHERE! - artoodetoo