|
 |
|
จะให้รายงานแสดงเฉพาะรายการที่ยังไม่ได้มารับของ โดยดูวันนัดรับสินค้าจากใบนัดรับสินค้า และให้คำนวณวันที่เกินมาว่า กี่วันแล้ว โดยนำเอา วันปัจจุบัน ลบ วันนัดรับสินค้า จะเขียนเป็นโค้ดยังไงอ่ะค่ะ รบกวนหน่อยค่ะ |
|
 |
|
|
 |
 |
|
คือจะให้รายงานแสดงเฉพาะรายการที่ยังไม่ได้มารับของ โดยดูวันนัดรับสินค้าจากใบนัดรับสินค้า และให้คำนวณวันที่เกินมาว่า
กี่วันแล้ว โดยนำเอา วันปัจจุบัน ลบ วันนัดรับสินค้า จะเขียนเป็นโค้ดยังไงอ่ะค่ะ รบกวนหน่อยค่ะ
Code (PHP)
<?php
$conn=mysql_connect("localhost","root","718293456") or die (" เชื่อมต่อเซฟไม่ได้");
$db=mysql_select_db("silver melt service") or die ("ไม่มีDB นี้");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$sql="SELECT appointcard.appointcardno,appointcard.appointdate,customer.cusid,customer.cusname,customer.cussername,
goods.goodsid,goods.goodsname
FROM appointcard,customer,goods
WHERE goods.appointcardno=appointcard.appointcardno AND
appointcard.cusid=customer.cusid
ORDER BY appointcardno ASC";
$a=date('d');
$b=date('n');
$c=date('Y')+543;
$day=date("$c-$b-$a");
$query=mysql_query("$sql") or die ("errorAPPCUS=$sql");
$num = mysql_num_rows($query);
for($i=1;$i<=$num;$i++) {
$row = mysql_fetch_array($query);
$dd=$row['appointdate']-$day;
echo "<tr>";
echo "<td>".$row['appointcardno'];
echo "<td>".$row['goodsid'];
echo "<td>".$row['cusname']." ".$row['cussername'];
echo "<td>".$dd;
echo "</tr>";
}
?>




Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-11-25 23:00:55 |
By :
am_mini |
View :
1070 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เท่าที่ดูแล้วไม่ยากน่ะครับ แค่ WHERE พวก Status เข้าไปครับ ส่วนเกินมาแล้วกี่วันใน MySQL มันมีพวก DATEDIFF มาให้ครับ
ผมแนะนำแค่แนวทางครับ
|
 |
 |
 |
 |
Date :
2012-11-27 06:27:36 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|