php列出mysql表的所有行和列

编程入门 行业动态 更新时间:2024-10-26 17:19:59
<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>
  • 0
  • 0
  • 0
  • 0
  • 0

更多推荐

php列出mysql表的所有行和列

本文发布于:2023-05-27 19:33:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/300568.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:php   mysql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!