Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <html lang="ru">
- <meta charset="UTF-8">
- </head>
- </html>
- <?php
- $host = '';
- $user = '';
- $pass = '';
- $db_name = '';
- $link = mysqli_connect($host, $user, $pass, $db_name);
- mysqli_set_charset($link, 'utf8');
- if (!$link) {
- echo 'Не могу соединиться с БД. Код ошибки: ' . mysqli_connect_errno()
- . ', ошибка: ' . mysqli_connect_error();
- exit;
- }
- $id = $_POST['id'];
- $title = $_POST['title'];
- $text = $_POST['text'];
- $code = $_POST['code'];
- if (isset($_POST["button"])) {
- $sql = mysqli_query($link, "INSERT INTO `python` (`id`, `title`, `text`,
- `code`) VALUES ($id, $title, $text, $code)");
- if ($sql) {
- echo '<p>Данные успешно добавлены в таблицу.</p>';
- echo '<meta http-equiv="refresh" content="0; url=../add">';
- } else {
- echo '<p>Произошла ошибка: ' . mysqli_error($link) . '</p>';
- }
- }
- ?>
- Произошла ошибка: You have an error in your SQL syntax; check the manual
- that corresponds to your MariaDB server version for the right syntax to
- use near 'test():
- print('Test')
- test())' at line 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement