Advertisement
Guest User

Untitled

a guest
May 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $baza = "lab11";
  6.  
  7. $conn = @new mysqli($host, $username, $password, $baza);
  8. if ($conn->connect_error) {
  9. die('Wystąpił błąd połączenia: ' . $conn->connect_errno);
  10. }
  11. $conn->query("set names utf8");
  12.  
  13. $sql = "INSERT INTO komentarze (id_posta, nick, tresc) VALUE (" . $_GET['id'] . ",'" . $_POST['nick'] . "','" . $_POST['tresc'] . "')";
  14.  
  15. if ($conn->query($sql) === TRUE) {
  16. header("Location: post.php?id=".$_GET['id']);
  17. } else {
  18. echo "Błąd: " . $sql;
  19. }
  20.  
  21. $conn->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement