|
|
|
รบกวนขอ code แบบนี้หน่อยครับ ทำมา 2 อาทิตย์ยังไม่ได้เลย |
|
|
|
|
|
|
|
ตัวอย่าง
Link https://www.thaicreate.com/upload/stock/20091111162544.jpg
แบบว่าพอกด ที่action ก็จะมี detail show ให้ดูทั้งหมด ตาม id ครับ
[font=Verdana]code หน้าหลัก[/font]
Code (PHP)
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="80%" id="AutoNumber1">
<tr>
<td width="10%" bgcolor="#CCFFFF" align="center"><b><font color="#000080">No.HSA</font></b></td>
<td width="5%" bgcolor="#CCFFFF" align="center"><b><font color="#000080">Line</font></b></td>
<td width="13%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Date</font></b></td>
<td width="5%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Shift</font></b></td>
<td width="13%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Machine</font></b></td>
<td width="10%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Number Machine</font></b></td>
<td width="13%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Problem</font></b></td>
<td width="8%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Downtime ( Min )</font></b></td>
<td width="7%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">STATUS</font></b></td>
<td width="5%" bgcolor="#CCFFFF" align="center"><b> <font color="#000080">Action</font></b></td>
</tr>
<?php
require("config.inc.php");
if (empty($_GET["page"])){
$page=1;
}
else
{
$page=$_GET["page"];
}
mysql_connect($host,$username,$password) or die("ติดต่อฐานข้อมูลไม่ได้");
mysql_select_db($db)or die ("เลืกข้อมูลไม่ได้");
$sql = "select * from downtime ";
$result = mysql_query("select id from downtime order by ID DESC");
$dbquery = mysql_db_query($db,$sql);
$NRow = mysql_num_rows($result);
$num_rows = mysql_num_rows($dbquery);
$rt = $NRow%$list_page;
if($rt!=0) {
$totalpage = floor($NRow/$list_page)+1;
}
else {
$totalpage = floor($NRow/$list_page);
}
$goto = ($page-1)*$list_page;
$sql = "select * from downtime where id order by id DESC limit $goto,$list_page";
$result = mysql_db_query($db,$sql);
$NRow = mysql_num_rows($result);
$stat = mysql_query("select carlender1 from downtime");
$id = "select id from downtime";
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="10%" bgcolor="#CCCCFF" align="center"><?php echo sprintf("<B>%06d</B>",$row['id']) ; ?></td>
<td width="5%" bgcolor="#CCCCFF" align="center"><?php echo $row['cline'] ; ?></td>
<td width="13%" bgcolor="#CCCCFF" align="center"><?php echo $row['carlender'] ; ?></td>
<td width="5%" bgcolor="#CCCCFF" align="center"><?php echo $row['cShift'] ; ?></td>
<td width="13%" bgcolor="#CCCCFF" align="center"><?php echo $row['cMachine'] ; ?></td>
<td width="10%" bgcolor="#CCCCFF" align="center"><?php echo $row['cNumber'] ; ?></td>
<td width="13%" bgcolor="#CCCCFF" align="center"><?php echo $row['problem'] ; ?></td>
<td width="5%" bgcolor="#CCCCFF" align="center"><?php echo $row['sum1'] ; ?></td>
<td width="7%" bgcolor="#CCCCFF" align="center">
<?php
$row = mysql_fetch_row($stat);
$status = $row['carlender1'];
echo "<center>";
if ($status == "")
{
$show = "<font size=2 color=red><b>Incomplete</b></font>";
}
else
{
$show = "<font size=3 color=black><b>Complete</b></font>";
}
echo "$show ";?></td>
<td width="5%" bgcolor="#CCCCFF" align="center"><center><a href="actiondata.php?id=$id"><img src="images/edit.gif" width="15" height="15" border="0"></a></center></td>
</tr>
<?Php
}
echo "</ul>\n";
?>
</table>
<br>
<?php
$result = mysql_query("select count(id) from downtime");
$row = mysql_fetch_row($result);
$num = $row[0];
echo "<center>";
if ($num == "")
{
//$entry = "ยังไม่มีใบแจ้งซ่อม";
}
else
{
$entry = "<font size=2 color=black><b>มีใบแจ้งซ่อมทั้งหมดจำนวน<Font color=red> $num </Font>ใบ </b></font>";
}
echo "<BR>$entry ";
echo "</center>";
//echo "\t กำลังแสดงหน้าที่ $page/$totalpage \n";
echo "\t<font size=2 color=black><b>หน้าที่ $page/$totalpage</b></font> \n";
echo "<center>";
echo "<center>";
if($page>1 && $page<=$totalpage) {
$prevpage = $page-1;
echo "\t<a href='action.php?&page=$prevpage'><< Back</a>\n";
}
// วนลูปแสดงเลขหน้าทั้งหมด
for($i=1 ; $i<$page ; $i++) {
echo "\t<a href='action.php?&page=$i'>$i</a> \n";
}
echo "\t<font size=2 color=red><b>$page</b></font> \n";
for($i=$page+1 ; $i<=$totalpage ; $i++) {
echo "\t<a href='action.php?&page=$i'>$i</a> \n";
}
if($page!=$totalpage) {
$nextpage = $page+1;
echo "\t<a href='action.php?&page=$nextpage'>Next >></a>\n";
}
?>
นี่คือ Code ทีพอ click action แล้ว show detail ตาม id
Code (PHP)
<?php
include "config.inc.php";
// เริ่มติดต่อฐานข้อมูล
mysql_connect($hostname, $user, $passwd) or die("ติดต่อฐานข้อมูลไม่ได้");
$sql = "select* from downtime ";
$db_query = mysql_db_query($db, $sql);
if (!$db_query)
{
echo("<b><font size=3>เอ็กซิคิวต์คำสั่ง SQL ไม่ได้ </b></font>" . mysql_error() );
exit;
}
else
{
$nums_rows = mysql_num_rows($db_query); // จำนวนเรกคอร์ดของกระทู้ทั้งหมด
//
// echo "<B>ลบข้อความ</B> ";
// echo "<a href=\"logout.php\">logout</a> <hr size=1>";
// เริ่มวนรอบแสดงข้อมูล
// echo "<ul>\n";
for ($i=0;$i<$nums_rows;$i++) // อ่านข้อมูลแต่ละเรกคอร์ด
{
$result = mysql_fetch_array($db_query);
//$id = $result[id];
//$cline = $result[cline];
//$carlender = $result[carlender];
//$cShift = $result[cShift];
$db_query1 = mysql_db_query ($db, $sql1);
//$num_rows = mysql_num_rows($db_query1);
$stat = mysql_query("select carlender1 from downtime");
}
?>
<TABLE borderColor=#f9f9f9 cellSpacing=0 cellPadding=0 width="100%"
border=1>
<TBODY>
<TR bgColor=#ff0000>
<TD colSpan=2>
<DIV align=center><STRONG><FONT face=Tahoma color=#ffffff
size=2>-:DOWNTIME REPAIR REQUEST FROM:- </FONT></STRONG></DIV></TD></TR>
<TR bgColor=#f4f4f4>
<TD width="45%"><FONT face=Tahoma color=#000099
size=2> </FONT></TD>
<TD width="55%"><FONT face=Tahoma color=#000099
size=2> </FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>No.HSA.</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<?php echo sprintf("<B>%06d</B>",$result['id']) ; ?>
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>Line/Station :</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<?php echo $result['cline'] ; ?>
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4><TD>
<DIV align=right><FONT face=Tahoma color=#000099
size=2> Request Date:</FONT></DIV></TD>
<TD> <FONT face=Tahoma color=#000099 size=2>
<?php echo $result['carlender'] ; ?>
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>Time
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=time
id=time size="15">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>Shift
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=cShift
id=cShift size="40">
</FONT></TD>
</TR><!--
<tr bgcolor="#F4F4F4">
<td><div align="right"><font color="#000099" size="2" face="Tahoma">Type
:</font></div></td>
<td> <font color="#000099" size="2" face="Tahoma">
<select name="ptype" id="ptype" >
<option value="all">All</option>
<option value="01">01</option>
</select>
</font></td>
</tr>
-->
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>Machine
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=cMachine
id=cMachine size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD height="26"><DIV align=right><FONT face=Tahoma color=#000099 size=2>Number Machine
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=cNumber
id=cNumber size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>Problem description
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<textarea name="problem" cols="40" id="problem"></textarea>
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>ชื่อผู้แจ้งซ่อม
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2> <INPUT name=name
id=name size="40">
</FONT></TD></TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>ตำแหน่ง
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=cPosition
id=cPosition size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>แผนก
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=cSection
id=cSection size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099
size=2>เวลาที่ซ่อมเสร็จ :</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2> <INPUT name=time1
id=time1 size="15">
</FONT></TD></TR>
<TR bgColor=#f4f4f4>
<TD>
<DIV align=right><FONT face=Tahoma color=#000099 size=2>รวมเวลที่ใช้ในการซ่อม :</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2> <INPUT name=sum
id=sum size="5"> <label>Min </label>
<label></label>
<INPUT name=cDowntime
id=cDowntime size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>ชื่อผู้แจ้งซ่อมลงชื่อตรวจรับเครื่อง
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=name2
id=name2 size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD colspan="2"><FONT face=Tahoma color=#000099> </FONT><FONT face=Tahoma><span class="style4">MAINTENANCE ACTION</span></FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>Repair Date
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=cDate1
id=name13 size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>Time
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=time1
id=name14 size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>Cause
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<textarea name="cause" cols="40" id="name15"></textarea>
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>Action
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<textarea name="action" cols="40" id="name11"></textarea>
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>ซ่อมโดย
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=name3
id=name3 size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><DIV align=right><FONT face=Tahoma color=#000099 size=2>ตรวจสอบโดยหัวหน้าแผนก
:</FONT></DIV></TD>
<TD><FONT face=Tahoma color=#000099 size=2>
<INPUT name=name4
id=name16 size="40">
</FONT></TD>
</TR>
<TR bgColor=#f4f4f4>
<TD><FONT face=Tahoma color=#000099 size=2> </FONT></TD>
<TD> </TD>
</TR></TBODY></TABLE>
<TABLE width="100%" height="34" border=1 bgcolor="#FF0000">
<TBODY>
<TR>
<TD width="98%" height="28" vAlign=top><font face=Tahoma color=#000099 size=2>
<input type="submit" name="submit" id="button" value="SAVE" onclick="return confirm('ต้องการSAVE ข้อมูลหรือไม่');" />
</font></TD>
</TR>
</TBODY>
</TABLE></TD></TR>
</TBODY></TABLE>
<span class="style1"></span><STRONG><FONT
color=#000099></FONT></STRONG></DIV>
</CENTER></TD></TR></TBODY></TABLE>
</FORM></BODY></BASEFONT></HTML>
<?php
mysql_close();
}
?>
ขอบคุณครับ
Tag : - - - -
|
|
|
|
|
|
Date :
2009-11-11 16:41:01 |
By :
naruto1981 |
View :
1000 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไฟล์ showdetail นะครับ ใส่เพิ่มเข้าไป
$id=$_GET['id'];
$sql = "select* from downtime where id='$id'";
deawx
[email protected]
ปรึกษา PHp ฟรีครับCode (PHP)
|
|
|
|
|
Date :
2009-11-11 19:39:50 |
By :
deawx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้เลย ครับ รบกวนอีกครั้งครับ
|
|
|
|
|
Date :
2009-11-12 07:31:31 |
By :
nong |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมงงกับคำถาม รบกวนช่วยบอกจุดประสงค์หลักๆอีกทีครับ เผื่อท่านอื่นผ่านมาแล้วจะเข้าใจ คำถามที่เขาไม่เข้าใจเขาจะไม่ค่อยตอบกันครับ
|
|
|
|
|
Date :
2009-11-13 14:58:52 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้แล้วคับ
thank
|
|
|
|
|
Date :
2009-11-14 14:49:21 |
By :
nong |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|