Advertisement
Guest User

Untitled

a guest
Oct 26th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_POST['update']))
  4. {
  5.  
  6. $hostname = "localhost";
  7. $username = "root";
  8. $password = "";
  9. $databaseName = "postai";
  10.  
  11. $connect = mysqli_connect($hostname, $username, $password, $databaseName);
  12.  
  13.  
  14. $img = $_POST['img'];
  15. $tekstas = $_POST['tekstas'];
  16. $autorius= $_POST['autorius'];
  17.  
  18. $query = "UPDATE news SET tekstas='$tekstas.' ";
  19.  
  20. $result = mysqli_query($connect, $query);
  21.  
  22. if($result)
  23. {
  24. echo 'Atnaujinta<br><br><br>';
  25. }else{
  26. echo 'Neatnaujinta';
  27. }
  28. mysqli_close($connect);
  29. }
  30.  
  31. ?>
  32.  
  33. <!DOCTYPE html>
  34.  
  35. <html>
  36.  
  37. <head>
  38.  
  39. <meta charset="UTF-8">
  40.  
  41. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  42.  
  43. </head>
  44.  
  45. <body>
  46.  
  47. <form action="atnaujinti.php" method="post">
  48.  
  49. Tekstas: <input type="text" name="tekstas"><br><br>
  50. Autorius: <input type="text" name="autorius"><br><br>
  51. IMG URL: <input type="text" name="img"><br><br>
  52.  
  53. <input type="submit" name="update" value="Atnaujinti">
  54.  
  55. </form>
  56.  
  57.  
  58. </body>
  59.  
  60.  
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement