<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
	
	<script src="/js/jquery-2.1.0.min.js"></script>
	<script src="/js/jquery.redirect.js"></script>
	<script type="text/javascript">   
function Redirect() 
{  
	

$.redirect('indexdevlecture.php', {'dnumdevis': document.getElementById("dnumdevis").value });

	
} 
//document.write("You will be redirected to a new page in 5 seconds"); 
setTimeout('Redirect()', 500);   
</script>
	
	<style>
	
.attente{
	width:110px;
	height:110px;
	position:absolute;
	left:50%;
	top:50%;
	margin:-75px 0 0 -135px;
}
	</style>
	<img class="attente" src="spinner.gif">
	
	
	<?php 
	
 $ordl = $_POST['lignedel'];
 $RechIdx = $_POST['devnum'];	
	
	
		$debug=0;
	
	if ($debug==1)   { 
	print "ligne devis ".$ordl; 
	print "<br>ligne devis ".$_POST['ligne']; 
	print "<br>".$RechIdx."  <br>";
			}
	
$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "devis";

	// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
			 
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 	
		

  
	
		
		
	 
	   
		$sql = "DELETE FROM `corps` WHERE ordre=".$ordl." AND numidxdevis=".$RechIdx." ";
	
		
	if ($debug==1)   { print $sql;  print "<br>"; } 
$result = $conn->query($sql);
	
	
		$sql = "UPDATE `corps` SET ordre= ordre-1 WHERE  ordre>=".$ordl." AND numidxdevis=".$RechIdx." ";
	
		
	if ($debug==1)   { print $sql;  print "<br>"; } 
$result = $conn->query($sql);
	
		
  

			 
if ($result->num_rows > 0) {
    // output data of each row
    while($drow = $result->fetch_assoc()) {
	//  
			
    } 
	
	} else {
  if ($debug==1)   { echo "0 results";} 
}
			 
$conn->close();		
	
	
	
	
	?>
	
	
			<form method = "post" action = "indexdevlecture.php">	

				<input type="hidden" size="60" name="dnumdevis" id="dnumdevis" value="<?php echo $RechIdx; ?>" > 
		
       	
			
			<input class="form-control" name = "update" type = "submit" id = "update" value = "suivant"><br>
	

<body>
</body>
</html>