<?php
if(!isset($_SESSION)) {  session_start(); }
ob_start();
if(!isset($_SESSION["user_id"])){header("location:../logout.php");}
include "../actions/dbPDO.php";
if(isset($_POST["line_id"]))
$idd = $_POST["line_id"] ;
{
	$mass = $db->prepare("SELECT mat_in_id from items_line where line_id = $idd");
	$mass->execute();
	if($mass->rowCount()>0){$row = $mass->fetch(PDO::FETCH_ASSOC);
      $inv = $row['mat_in_id'];}
	$sql = $db->prepare("DELETE FROM items_line
		WHERE line_id = $idd LIMIT 1");
	$sql->execute();
  if($sql->rowCount()>0){
		echo $inv;
	}else{ echo "<div class='alert alert-danger'>
  <a href='#' class='close' data-dismiss='alert' aria-label='close'style='float:left;'>&times;</a>
    <b>يوجد خطا في الإتصال ..</b>
  </div>
  ";}
}
?>
