php列出mysql表的所有行和列

2018-07-20    来源:open-open

容器云强势上线!快速搭建集群,上万Linux镜像随意使用
<html>
<head>
<title>Selecting Data</title>
</head>
<body>
<?php
$user = "root";
$pass = "";
$db = "mydatabase";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link ) {
  die( "Couldn't connect to MySQL: ".mysql_error() );
}mysql_select_db( $db, $link ) or die ( "Couldn't open $db: ".mysql_error() );$result = mysql_query( "SELECT * FROM domains where sex='F'" );
$num_rows = mysql_num_rows( $result );print "<p>$num_rows women have added data to the table</p>\n";print "<table>";
while ( $a_row = mysql_fetch_row( $result ) ) {
  print "<tr>";
  foreach ( $a_row as $field ) {
    print "<td>".stripslashes($field)."</td>";
  }
  print "</tr>";
}
print "</table>";
mysql_close( $link );
?>
</body>
</html>

标签: Mysql

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。

上一篇:php限制上传文件类型并保存上传文件

下一篇:php使用百度翻译api示例分享