av网站免费线看精品_国产做a爱视频免费不_深爱激情网开心五月天_伊人五月天在线视频网

 
PHP經(jīng)驗(yàn)交流:php訪問(wèn)access的方法
發(fā)布時(shí)間:2008-05-23   瀏覽次數(shù):1199543
PHP經(jīng)驗(yàn)交流:php訪問(wèn)access的方法 php訪問(wèn)mysql的方法,地球人都知道,不過(guò)訪問(wèn)access麻煩點(diǎn),我們一起也來(lái)學(xué)習(xí)下吧,因?yàn)樵趯?shí)際應(yīng)用中也會(huì)要用到。在虛擬目錄下訪問(wèn)需要轉(zhuǎn)化下數(shù)據(jù)庫(kù)文件所在的路徑。這里采用ADODB庫(kù)作為測(cè)試。代碼如下: include(’adodb/tohtml.inc.php’); // load code common to ADODB include(’adodb/adodb.inc.php’); // load code common to ADODB $NowPathArray=explode("include",str_replace("\","/",dirname(__FILE__))) ;//強(qiáng)制將windows下"分隔符"轉(zhuǎn)化為/ @define("ROOT_PATH", $NowPathArray[0]); //數(shù)據(jù)庫(kù)部分參數(shù)設(shè)置 //@define("TBL_PREFIX", "bluedn_"); //當(dāng)前數(shù)據(jù)庫(kù)前綴 @define("DB_PATH", ROOT_PATH."/db/data.mdb"); //echo DB_PATH; @define("DB_TYPE", "access"); //數(shù)據(jù)庫(kù)類(lèi)型 $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=".DB_PATH.";Uid=;Pwd=;"; $conn = &ADONewConnection(DB_TYPE); :)}$conn->Connect($dsn); )$conn->SetFetchMode( ADODB_FETCH_ASSOC );//設(shè)置以字段名來(lái)讀取存儲(chǔ)位數(shù)組的下標(biāo),ADODB_FETCH_NUM(以欄位順序存取)默認(rèn)都有為ADODB_FETCH_BOTH(雙模式存取) //$conn->debug=true; //設(shè)置為true 跟蹤數(shù)據(jù)庫(kù)操作 $sqlnum=0; //記錄數(shù)據(jù)庫(kù)操作的次數(shù) JV5/j|FQ $sql = ’select * from main’; $rs = $conn->Execute($sql); rs2html($rs,’border=2 cellpadding=6’,array(’ID’,’標(biāo)題’,’作者’,’來(lái)源’,’內(nèi)容’,’日期’)); ?>
立即預(yù)約