<?php
include('./lib/dbcon.php'); 
dbcon();
include('session.php'); 
 $get_id = $_GET['id'];
 $stdev_id = $_GET['stdev_id'];

  ?>
   <?php $location_query = mysqli_query($con,"select * from stlocation	                     
	                         where stdev_id = '$stdev_id'");
	                         $location_row = mysqli_fetch_array($location_query);
	                        ?>
							
							<?php
									$query = mysqli_query($con,"select * from stdevice 
									LEFT JOIN device_name ON stdevice.dev_id=device_name.dev_id
									where id = '$get_id'");
									$row = mysqli_fetch_array($query);
									$dev_name= $row['dev_name'];									
									?>	
										
										<?php
									
										mysqli_query($con,"DELETE FROM stdevice where id = '$get_id' ");
																										
									    mysqli_query($con,"insert into activity_log (date,username,action) values(NOW(),'$admin_username','Delete device info $dev_name')");
										 header("Location: mydevice.php");
										?>
										
										<script>
										window.location = "mydevice.php<?php echo '?stdev_id='.$stdev_id; ?>"; 
										$.jGrowl("Device Status Successfully Delete", { header: 'Device Status delete' });
										</script>
								
									
								