[心得] homework.php
<!doctype html public "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>作業查詢</title>
<meta http-equiv="generator" content="PHP Designer 2005" />
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080"
alink="#FF0000">
<br>
<center><font size="5">作業繳交情況與下載</font></center>
<br>
<table border="1" cellspacing="1" cellspadding="1" align="center">
<tr>
<td align ="center" bgcolor ="#ffffcc" width ="15%"><font size="2"
color="Blue">學號</font></td>
<td align ="center" bgcolor ="#ffffcc" width ="25%"><font size="2"
color="Blue">作業名稱</font></td>
<td align ="center" bgcolor ="#ffffcc" width ="15%"><font size="2"
color="Blue">姓名</font></td>
<td align ="center" bgcolor ="#ffffcc" width ="12%"><font size="2"
color="Blue">繳交日期</font></td>
<td align ="center" bgcolor ="#ffffcc" width ="25%"><font size="2"
color="Blue">檔案名稱</font></td>
<td align ="center" bgcolor ="#ffffcc" width ="6%"><font size="2"
color="Blue">下載</font></td>
</tr>
<?php
////////******************************////////
////////
////////******************************////////
$intODBCConnectHandle = odbc_connect("WORKODBC","Sa","") ;
if ($intODBCConnectHandle != 0)
{
$intOpenTableResultID = odbc_exec($intODBCConnectHandle,
"SELECT * FROM homework") ;
$varDataArray = odbc_fetch_array ($intOpenTableResultID) ;
while (strlen($varDataArray) > 0)
{
echo "<tr>" ;
echo "<td bgcolor='#FFFF99' align='center'><font size='2'
color='Blue'>",
$varDataArray[studentno],"</font></td>" ;
echo "<td bgcolor='#FFFF99' align='center'><font size='2'
color='Blue'>",
$varDataArray[workname],"</font></td>" ;
echo "<td bgcolor='#FFFF99' align='center'><font size='2'
color='Blue'>",
$varDataArray[name],"</font></td>" ;
echo "<td bgcolor='#FFFF99' align='center'><font size='2'
color='Blue'>",
$varDataArray[nowDate],"</font></td>" ;
echo "<td bgcolor='#FFFF99' align='center'><font size='2'
color='Blue'>",
$varDataArray[fileNameSet],"</font></td>" ;
echo "<td bgcolor='#FFFF99' align='center'><font size='2'
color='Blue'>
<a href='http://localhost/Temp/",$varDataArray[fileNameSet], "'>檔案
下載</a></td>" ;
echo "</tr>" ;
$varDataArray = odbc_fetch_array ($intOpenTableResultID) ;
}
odbc_close ($intODBCConnectHandle) ;
}
else
{
echo "ERROR-資料庫連結失敗 !!!" ;
}
?>
</table>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.128.142.226