Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Tuotteen poisto kannasta</title>
  4. </head>
  5. <body>
  6. <div align="center">
  7. <?php
  8. include("Header.php");
  9.  
  10.  
  11. $id = $_POST['id'];
  12.  
  13.  
  14. //Yhteys tietokantaan
  15.  
  16. $type="mysql";
  17. $user="root";
  18. $pwd="";
  19. $host="localhost";
  20. $dbname="testikauppa";
  21.  
  22. $link=mysql_connect($host, $user, $pwd);
  23. if (!$link){
  24. die('ei yhteyttä:' .mysql_error());
  25. }
  26.  
  27. $poistettava = mysql_query('SELECT *FROM tuotteet WHERE id like $id');
  28.  
  29. if($id == $poistettava){
  30. $sql = 'DELETE FROM tuotteet WHERE id=$id';
  31. echo "Tuote poistettu onnistuneesti";
  32. } else {
  33. die('Tuotetta ei voitu poistaa/virheellinen ID'. mysql_error());
  34. }
  35.  
  36. ?>
  37.  
  38. </div>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement