一个简单PHP显示页面
发布网友
发布时间:2022-05-01 23:37
我来回答
共1个回答
热心网友
时间:2022-06-25 03:51
<?php
$con = mysql_connect("localhost","root","密码");
if (!$con){die('Could not connect: ' . mysql_error());}
mysql_select_db("wexeditor", $con);
mysql_query("set names utf8");
$result = mysql_query("SELECT name,tel,kd,dh,datetime FROM student");
echo "<table border='1'>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['tel']."</td>";
echo "<td>".$row['kd']."</td>";
echo "<td>".$row['dh']."</td>";
echo "<td>".date("Y-m-d",$row['datetime'])."</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
这个其实就是PHP手册里的一个例子,多看看手册,对你有帮助