<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("my_db", $con); //选取数据库


/////////////////////////////////查询指定name的数据
$result = mysql_query("SELECT * FROM world WHERE Name='$_POST[Name]'");
echo "<table border='1'>
<tr>
<th>id</th>
<th>name</th>
<th>location</th>
</tr>
";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Id'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Location'] . "</td>";
echo "</tr>";
}
echo "</table>";

/////////////////////////////////关闭连接
mysql_close($con);
?>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-05-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-07-03
  • 2022-12-23
  • 2021-11-17
  • 2021-05-06
相关资源
相似解决方案