Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $username = 'root';
- $password = '';
- $database = 'forum';
- $conn = new mysqli($host, $username, $password, $database);
- if ($conn->connect_error) {
- die("Ошибка подключения к базе данных: " . $conn->connect_error);
- }
- $query = $_GET['query'];
- $sql = "SELECT * FROM messages WHERE message_text LIKE '%$query%'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<a class='wow' href='topic.php?id=".$row["topic_id"]."'>Номер топика: " . $row['topic_id'] . " - Сообщение: " . $row['message_text'] . "<br>";
- }
- } else {
- echo "Ничего не найдено";
- }
- $conn->close();
- ?>
- <!DOCTYPE html>
- <html id="suka">
- <head>
- <title>Messages</title>
- <link rel="stylesheet" type="text/css" href="style.css">
- <link rel="stylesheet" href="fonts/fonts.css">
- </head>
- <body style="background: #11191F; display: flex; justify-content: center; position:relative; left:25%; align-items: center; height: 100vh; flex-direction: column;">
- <script src="./src/visual/dop.js"></script>
- <script src="./src/visual/back.js"></script>
- <script src="./src/visual/app.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement