<?php
include('../include/session.php');


$table_name = $_SESSION['db_prefix']."_tile_deliver_lines";
$deliver_lines_query = "SELECT delivery_no , order_reference FROM $table_name ORDER BY delivery_no ";
$deliver_lines_result = mySQL_query($deliver_lines_query);
$deliver_lines_num = mysql_num_rows($deliver_lines_result);


echo $deliver_lines_num;

$i=0;
while ($i<$deliver_lines_num) {
$delivery_no = mysql_result($deliver_lines_result, $i, "delivery_no");

$table_name = $_SESSION['db_prefix']."_tile_deliver";
$deliver_query = "SELECT deliver_date, cust_id FROM $table_name WHERE delivery_no = '".$delivery_no."'  ";
$deliver_result = mySQL_query($deliver_query);
$deliver_num = mysql_num_rows($deliver_result);
$deliver_date = mysql_result($deliver_result, 0, "deliver_date");
$cust_id = mysql_result($deliver_result, 0, "cust_id");

$table_name = $_SESSION['db_prefix']."_tile_deliver_lines";
$date_query = "UPDATE $table_name SET deliver_date = '".$deliver_date."', cust_id = '".$cust_id."' WHERE delivery_no = '".$delivery_no."' ";
echo '<br>*****'.$date_query;
execsql($date_query);


$i++;
}
?>