Re: [請益] PHP連oracle (已爬文)

看板PHP作者 (台灣獨立公投入聯)時間18年前 (2008/01/24 17:26), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
連oracle應該滿簡單的 //oracle_db_conn.php-start <? $conn = &ADONewConnection('oci8'); //$conn->debug=true; $mch="192.168.0.1"; //oracle ip $user="羽山秋人"; $pwd="#$#@$#$@#$"; $database="ALLDATA"; //db name $cstr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.1) (PORT=1521)) (CONNECT_DATA=(SID=ora817)))"; //請注意SID後面要和你oracle一樣 $conn->Connect($cstr, $user, $pwd); ?> //oracle_db_conn.php-end include('inc/adodb/adodb.inc.php'); include('inc/oracle_db_conn.php'); 最簡單把資料拿到array就下面這種.. $sql="select ALL_ID,SUBJECT,'','','','0','0','0',WORDS,'' from ALLDATA where ALL_ID='".$EMT_id."' "; $rs = $conn->Execute($sql); //$rs = $conn->SelectLimit($sql,200,1); // 當尚未到達 記錄集 $rs 的結束位置(EOF:End Of File)時,(即:還有記錄尚未取出時) $res_array; $index=0; while (!$rs->EOF) { // 秀出所有欄位,$FieldCount() 會傳回欄位總數 for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) { $res_array[$index][$i]=$rs->fields[$i]; } // 移至下一筆記錄 $rs->MoveNext(); $index++; } 如此這般... -- 3WA訓練家的工作室 宗旨:人生就是要爽 個人佈弱格 網址:http://3wa.myvnc.com -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.56.213.47
文章代碼(AID): #17c5dY3w (PHP)
文章代碼(AID): #17c5dY3w (PHP)