这篇文章主要为大家详细介绍了php列出mysql表所有行和列的简单示例,具有一定的参考价值,可以用来参考一下。
对php列出mysql表的所有行和列感兴趣的小伙伴,下面一起跟随512笔记的小编两巴掌来看看吧!
/**
* 列出mysql表的所有行和列
*
* @param
* @arrange 512-笔记网: www.512Pic.com
**/
$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 "
$num_rows women have added data to the table
\n";print "while ( $a_row = mysql_fetch_row( $result ) ) {
print "
";foreach ( $a_row as $field ) {
print "
".stripslashes($field)."";}
print "
";}
print "
";mysql_close( $link );
/*** 来自512笔记(www.512pic.com) ***/
注:关于php列出mysql表所有行和列的简单示例的内容就先介绍到这里,更多相关文章的可以留意512笔记的其他信息。
关键词:列出行
您可能感兴趣的文章