日期:2014-05-16 浏览次数:20495 次
<html>
<body>
<?php
$con = mysql_connect("127.0.0.1","root","root");
if(!con){
die('Could not connect:'.mysql_error());
}else{
mysql_select_db("test",$con);
$result = mysql_query("select * from user");
echo "<table border='1'>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . count($row) . "</td>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
}
?>
</body>
</html>
echo "<table border='1'>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "</tr>";
}
echo "<tr><td>" . mysql_num_rows($result) . "</td></tr>";
echo "</table>";