先上图:
<?php
$servername = 服务器地址;
$username = 用户名;
$password = 数据库密码;
$dbname = 数据库名称;
$con = mysql_connect($servername,$username,$password ,$dbname ) or die('error:'.mysql_error());
mysql_query('set NAMES utf8');
$result=mysql_query("select * from `table1` order by num desc");
header('content-type:text/html;charset=utf-8');
print <<<EOT
<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:15px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
table-layout:fixed;
width:50%;
}
table.gridtable th {
border-width: 1px;
padding: 2px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 2px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
table.gridtable tr {
text-align:center
}
</style>
<div style="text-align:center;margin:25 0 0 25">
<table class="gridtable">
<tr>
<th>时间</th>
<th>文本</th>
<th>标识</th>
</tr>
EOT;
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>".$row["date"]."</td><td>".$row["text"]."</td><td>".$row["id"]."</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
$con->close();
?>
欢迎使用小程序《文本整理器》及在线文本整理器wbzlq.com。
|
请发表评论