<?php
  include "../include/dbcon.php";
?>
<?php
  $porder = $_POST["txtorder"];
?>
<?php
  $num = count($porder);
  $i=1;
  foreach($porder as $tid=>$torder){
  
	if($i==$num){
	  $tcomma = "";
	}else{
	  $tcomma = ",";
	}
  
    $exquery = $exquery . "($tid,$torder)" . $tcomma;
	
	$i++;
  }
?>
<?php
  $query = "INSERT INTO tb_product (id,tb_order) VALUES" . $exquery;
  $query .= "ON DUPLICATE KEY UPDATE tb_order = VALUES(tb_order)";
  mysqli_query($conn,$query);
?>
<?php
  header("location: main.php?pg=pdt");
?>