php連接mysql的方法:
在php中,這個任務通過 mysql_connect() 函數完成。注意要確定mysql服務是啟動的,并且需要輸入您mysql的相關信息。
$con = mysql_connect("數據庫名","用戶名","密碼");if (!$con){die('Could not connect: ' . mysql_error());}// some code?>
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>