看板 Web_Design 關於我們 聯絡資訊
http://linux.tnc.edu.tw/techdoc/php/php_big5/ref.mysql.html <?php /* 連接選擇資料庫 */ $link = mysql_connect("mysql_host", "mysql_user", "mysql_password") or die("Could not connect"); print "Connected successfully"; mysql_select_db("my_database") or die("Could not select database"); /* 執行 SQL 查詢 */ $query = "SELECT * FROM my_table"; $result = mysql_query($query) or die("Query failed"); /* 在 HTML 中顯示結果 */ print "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print "\t<tr>\n"; foreach ($line as $col_value) { print "\t\t<td>$col_value</td>\n"; } print "\t</tr>\n"; } print "</table>\n"; /* 釋放資源 */ mysql_free_result($result); /* 斷開連接 */ mysql_close($link); ?> 應該有點用 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.229.205.231
jupiter86001:可以了! 謝謝!! 218.167.172.85 07/05