(1) 建立連接
(2)選擇數(shù)據(jù)庫(kù)
(3) 執(zhí)行SQL語(yǔ)句
(4) 關(guān)閉數(shù)據(jù)庫(kù)連接
<?php
$link=mysql_connect("localhost","root","root");
if($link)echo"連接數(shù)據(jù)庫(kù)成功!";
else echo"連接數(shù)據(jù)庫(kù)失敗!";
$sele=mysql_select_db("com");
if($sele) echo"選擇數(shù)據(jù)庫(kù)成功!";
else echo"選擇數(shù)據(jù)庫(kù)失?。?;
$exec="select * from test";
$result=mysql_query($exec);
echo $result."<br>";
$exec="insert into test values(null,'Janel',23,'female','wenmin cun 34#')";
$result=mysql_query($exec);
echo $result."<br>";
mysql_close();
?>
posted on 2009-07-01 11:00
期待明天 閱讀(219)
評(píng)論(0) 編輯 收藏 所屬分類:
PHP