<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include("connect.php");
$sql="select * from book1";
$query=mysql_query($sql) or die("error=$sql");
while($row=mysql_fetch_array($query))
{
$code=$row['code'];
$sqlc="select count(OUTDATE) as numc , substring(OUTDATE,11,2) as subs from book1 where substring(OUTDATE,11,2)='$code' ";
$queryc=mysql_query($sqlc) or die("error=$sqlc");
$rs=mysql_fetch_array($queryc);
echo "nums : $rs[nums] at $rs[subs]<br/>";
//$sqlI="update time_type set quantity=$rs[numc] where code='$code'";
//mysql_query($sqlI) or die("error=$sqlI");
}
mysql_close();
echo "<script>alert('บันทึกเรียบร้อยแล้ว');window.location='Index.php';</script>";
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include("connect.php");
$sql="select code from book1 group by code";
$query=mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($query))
{
$code=$row[code];
$sqlc="select count(OUTDATE) as numc , substring(OUTDATE,11,2) as subs from book1 where substring(OUTDATE,11,2)='$code' ";
$queryc=mysql_query($sqlc) or die(mysql_error()."<br/>error=$sqlc");
$rs=mysql_fetch_array($queryc);
echo "nums : $rs[nums] at $rs[subs]<br/>";
//$sqlI="update time_type set quantity=$rs[numc] where code='$code'";
//mysql_query($sqlI) or die("error=$sqlI");
}
mysql_close();
echo "<script>alert('บันทึกเรียบร้อยแล้ว');window.location='Index.php';</script>";
?>