|
|
|
รบกวนช่วยดู CODE ให้หน่อยนะครับ ผมติดตรงที่ SUM( std_statistics.sum_last ) AS sum_last, SUM( std_statistics.sum_noout ) |
|
|
|
|
|
|
|
Code (PHP)
<?
// Convert Variable Array To Variable
while(list($xVarName, $xVarvalue) = each($_GET)) {
${$xVarName} = $xVarvalue;
}
while(list($xVarName, $xVarvalue) = each($_POST)) {
${$xVarName} = $xVarvalue;
}
while(list($xVarName, $xVarvalue) = each($_FILES)) {
${$xVarName."_name"} = $xVarvalue['name'];
${$xVarName."_type"} = $xVarvalue['type'];
${$xVarName."_size"} = $xVarvalue['size'];
${$xVarName."_error"} = $xVarvalue['error'];
${$xVarName} = $xVarvalue['tmp_name'];
}
?>
<?php
session_start();
$ses_userid =$_SESSION[ses_userid];
$ses_username = $_SESSION[ses_username];
if($ses_userid <> session_id() or $ses_username ==""){
echo " No Login";
echo "<meta http-equiv='refresh' content='2;URL=index.php' />";
} else {
?>
<?
include("include/class.mysqldb.php");
include "include/dbconfig.php";
?>
<html>
<head>
<meta charset="windows-874">
<title>attend_late</title>
<style type="text/css">
a:hover {
color: #F9060A;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body>
</p>
<table width="75%" border="1">
<tr>
<td width="5%">id</td>
<td width="28%">name</td>
<td width="9%">ระดับชั้น</td>
<td width="9%">ห้อง</td>
<td width="11%">รวมสาย</td>
<td width="14%">รวมออกก่อน</td>
<td width="12%">เดือน</td>
<td width="12%">ปี</td>
</tr>
<?
//========================================================
$sql = "SELECT std_statistics.Stu_ID, student.Stu_Name, student.Stu_LName, student.Stu_Clase, student.Stu_Room, SUM( std_statistics.sum_last ) AS sum_last, SUM( std_statistics.sum_noout ) AS sum_noout, std_statistics.mouth, std_statistics.Year
FROM std_statistics
INNER JOIN student ON std_statistics.Stu_ID = student.Stu_ID
GROUP BY std_statistics.Stu_ID, student.Stu_Name, student.Stu_LName, student.Stu_Clase, student.Stu_Room, std_statistics.mouth, std_statistics.Year";
$result=mysql_query($sql) or die($sql."<br/>\n".mysql_error());
//$num_reg=mysql_num_rows($result);
//========================================================
//$sql="select * from pro";
$result=mysql_query($sql);
while($rs=mysql_fetch_array($result))
{
//$i++;
echo"<tr>";
echo"<td>$rs[Stu_ID]</td>";
echo"<td>$rs[Stu_Name] $rs[Stu_LName]</td>";
echo"<td>$rs[Stu_Clase]</td>";
echo"<td>$rs[Stu_Room]</td>";
echo"<td>$SUM( std_statistics.sum_last )</td>";
echo"<td>$SUM( std_statistics.sum_last )</td>";
echo"<td>$rs[mouth]</td>";
echo"<td>$rs[Year]</td>";
// echo"<td><a href='del.php?ID=$rs[ID]'>ลบ</a></td>";
// echo"<td><a href='form_edit.php?ID=$rs[ID]'>แก้ไข</a></td>";
echo"</tr>";
}
echo"</tr>";
?>
</table>
<p><br />
</p>
<p> </p>
</body>
</html>
<?php
}
?>
ผมติดตรงที่ SUM( std_statistics.sum_last ) AS sum_last, SUM( std_statistics.sum_noout ) ไม่ทราบว่าจะเอาส่วนนี้มาแสดงผลในตารางยังไงครับ
อยากให้แสดงตรงนี้ครับ
echo"<td>$SUM( std_statistics.sum_last )</td>";
echo"<td>$SUM( std_statistics.sum_noout )</td>";
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2015-04-06 16:50:03 |
By :
wittayakorn1 |
View :
624 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
082.echo "<td>$rs['sum_last']</td>";
083.echo "<td>$rs['sum_noout']</td>";
การกำหนด as ชื่อใหม่ สามารถเรียกชื่อใหม่ เสมือนชื่อfield ปกติได้เลยครับ
|
|
|
|
|
Date :
2015-04-06 17:04:44 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับ ขอบคุณมากครับ
|
|
|
|
|
Date :
2015-04-06 18:51:20 |
By :
wittayakorn1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|