|
 |
|
การใช้คำสั่ง Count ในการนับรายการที่อยู่ในใบเบิกหนึ่งใบ คือตอนนี้จะมันขั้นว่าในเลขที่ใบเบิกนี้มีรายการที่จะเบิกกี่รายการอ่ะค่ะ |
|
 |
|
|
 |
 |
|

Code (PHP)
<form id="form1" name="form1" method="post" action="">
<table width="90%" cellspacing="1" class="tablesorter">
<thead>
<tr>
<th width="117" align="center">เลขที่ใบเบิก</th>
<th width="112" align="center">วันที่เบิก</th>
<th width="194" align="center">ผู้รับเรื่อง</th>
<th width="115" align="center">แผนก</th>
<th width="115" align="center">จำนวนรายการ</th>
<th width="104" align="center">จ่าย</th>
</tr>
</thead>
<?
include("../connect.php");
$sql="SELECT
employee.name,
employee.lastname,
product_r.employee_id,
product_r.requisition_no,
department.name_department,
product_r.department_id,
product_r.requisition_date,
product_r.requisition_approve,
product_r.requisition_reques
FROM
product_r
Inner Join employee ON employee.employee_id = product_r.employee_id
Inner Join department ON department.department_id = product_r.department_id where product_r.requisition_no not in(select requisition_no from payout)";
$result=mysql_db_query($dbname,$sql);
while ($data = mysql_fetch_array($result)){
?>
<tr>
<td><?=$data['requisition_no']; ?></td>
<td><?=$data['requisition_date']; ?></td>
<td><?=$data['name'].' '.$data['lastname']; ?></td>
<td><?=$data['name_department']; ?></td>
<? $sql="SELECT
Count(*) AS t,
product_r.requisition_no
FROM
product_requisition_list
Inner Join product_r ON product_r.requisition_no = product_requisition_list.requisition_no
group by product_requisition_list.requisition_no '";
$result = mysql_db_query($dbname,$sql);
while ($data = mysql_fetch_array($result)){
}
?>
<td><? echo $t;?></td>
<td align="center"><? $condb->payout($data['requisition_no']) ;?></td>
</tr>
<?
} ?>
</table>
</form>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-08-26 16:46:36 |
By :
เป๋าตุง |
View :
2155 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 01
|