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");