Advertisement
Guest User

Untitled

a guest
May 26th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 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('Wystapil blad podczas laczenia: ' . $conn->connect_errno);
  10. }
  11. $conn->query("set names utf8");
  12.  
  13. $sql = "insert into posty (id_kategorii, tytul, tresc) value (".$_POST['cat'].",'".$_POST['title']."','".$_POST['content']."')";
  14.  
  15. if($conn->query($sql) === TRUE){
  16. header("Location: index.php");
  17. }else{
  18. echo "blad ".$sql;
  19. }
  20.  
  21. $conn->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement