-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_table.php
29 lines (24 loc) · 986 Bytes
/
delete_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include_once 'db_conn.php';
session_start();
$row_bolinmanomi = mysqli_fetch_row(mysqli_query($conn, "SELECT bolinmanomi FROM users WHERE `id` =".$_SESSION['id']));
$bolinmanomi = $row_bolinmanomi[0];
$username = $_SESSION['username'];
if(isset($_POST['delete_table']))
{
$id = $_SESSION['id'];
$query = "DELETE FROM `user401` WHERE `bolinma_nomi` = '$bolinmanomi' AND `data_username` = '$username'";
$query_run = mysqli_query($conn, $query);
$nullrows = "UPDATE `users` SET `bolinmanomi`= NULL, `1-mashq`= NULL, `2-mashq` = NULL, `3-mashq`= NULL, `4-mashq` = NULL WHERE `id`='$id'";
$nullrows_run = mysqli_query($conn, $nullrows);
if ($nullrows_run)
{
echo '<script>alert("Jadval o`chirildi"); </script>';
header("location:home.php");
}
else
{
echo '<script>alert("Ma`lumot o`chirilmadi"); </script>';
}
}
?>