<?php require("http://php.wilson.gs"); // 回首頁 echo "http://php.wilson.gs/bible/function.php : 函式:mysql_connect()"; |
函式:mysql_connect() |
mysql_connect開啟 MySQL 伺服器連線。 語法: int mysql_connect(string [hostname] [:port], string [username], string [password]); 傳回值: 整數 函式種類: 資料庫功能
本函式建立與 MySQL 伺服器的連線。其中所有的參數都可省略。當使用本函式卻不加任何參數時,參數 hostname 的內定值為 localhost、參數 username 的內定值為 PHP 執行行程的擁有者、參數 password 則為空字串 (即沒有密碼)。而參數 hostname 後面可以加冒號與埠號,代表使用那個埠與 MySQL 連接。當然在使用資料庫時,早點使用 mysql_close() 將連線關掉可以節省資源。
mysql_close() mysql_pconnect()
|
![]() mail("wilson@biglobe.net.tw", "Feedback", $message); ?> |