如何通過網(wǎng)站調(diào)用mysql數(shù)據(jù)庫(kù)

九三
625
2021-02-14 11:24:26
欄目: 云計(jì)算

如何通過網(wǎng)站調(diào)用mysql數(shù)據(jù)庫(kù)

PHP網(wǎng)站調(diào)用mysql數(shù)據(jù)庫(kù)的方法

1.連接數(shù)據(jù)庫(kù)

$con = mysql_connect("localhost","peter","abc123");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

// some code

?>

2.使用mysql_select_db()函數(shù)選擇數(shù)據(jù)庫(kù)

mysql_select_db("school",$con)

3.使用mysql_query()函數(shù)即可調(diào)用mysql數(shù)據(jù)庫(kù)中的數(shù)據(jù)

#result = mysql_query("select * form teacher");

0