SHARE
TWEET

Untitled

a guest May 19th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (isset($_POST["delete"])) {
  2.     $predmet = htmlspecialchars($_POST["predmety"]);
  3.     $id = 0;
  4.  
  5.     $sql8 = "SELECT id_predmet FROM predmet WHERE nazov = '$predmet'";
  6.     $result = $conn->query($sql8);
  7.  
  8.     if ($result->num_rows > 0) {
  9.         while ($row = $result->fetch_assoc()) {
  10.             $id = $row["id_predmet"];
  11.         }
  12.     } else {
  13.         echo "0 results";
  14.     }
  15.     echo "$id";
  16.     $sql9 = "DELETE FROM zaznam WHERE id_predmet ='$id'";
  17.     $sql10 = "DELETE FROM predmet WHERE id_predmet='$id'";
  18.     $sql11 = "DELETE FROM vysledky WHERE id_predmet='$id'";
  19.  
  20.     if (mysqli_query($conn, $sql9)) {
  21.         if (mysqli_query($conn, $sql10)) {
  22.             if (mysqli_query($conn, $sql11)) {
  23.             echo "delete success";
  24.         } else {
  25.                 echo "Error updating record: " . mysqli_error($conn);
  26.             }
  27.         } else {
  28.             echo "Error updating record: " . mysqli_error($conn);
  29.         }
  30.     } else {
  31.         echo "Error updating record: " . mysqli_error($conn);
  32.     }
  33.     header("Refresh:0");
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top