国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

php列出mysql表所有行與列的方法

2024-07-24 12:43:18
字體:
來源:轉載
供稿:網友

 這篇文章主要介紹了php列出mysql表所有行與列的方法,涉及php操作mysql數據庫的技巧,具有一定參考借鑒價值,需要的朋友可以參考下

  

本文實例講述了php列出mysql表所有行與列的方法。分享給大家供大家參考。具體實現方法如下:

代碼如下:<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>

 

希望本文所述對大家的php程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 连州市| 扬中市| 晋中市| 攀枝花市| 开化县| 比如县| 纳雍县| 宿州市| 丰原市| 贵德县| 神池县| 延长县| 同德县| 莱州市| 双辽市| 大厂| 兴业县| 尚志市| 油尖旺区| 麦盖提县| 婺源县| 富民县| 宝清县| 林周县| 安国市| 延吉市| 遂宁市| 元朗区| 若羌县| 衡阳县| 儋州市| 鄱阳县| 屯门区| 栾川县| 乐陵市| 桂林市| 伽师县| 沧源| 贵德县| 萨迦县| 龙泉市|