Oracle(甲骨文)是世界上最為流行的關(guān)系數(shù)據(jù)庫。它是大公司推崇的工業(yè)化的強有力的引擎。我們先看看其相關(guān)的函數(shù):

創(chuàng)新互聯(lián)公司從2013年開始,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目網(wǎng)站設(shè)計、做網(wǎng)站網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元永仁做網(wǎng)站,已為上家服務(wù),為永仁各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108
(1)integer
ora_logon(string
user
,
string
password)
開始對一個Oracle數(shù)據(jù)庫服務(wù)器的連接。
(2)integer
ora_open(integer
connection)
打開給出的連接的游標(biāo)。
(3)integer
ora_do(integer
connection,
string
query)
在給出的連接上執(zhí)行查詢。PHP生成一個指示器,解析查詢,并執(zhí)行之。
(4)integer
ora_parse(integer
cursor,
string
query)
解析一個查詢并準(zhǔn)備好執(zhí)行。
(5)boolean
ora_exec(integer
cursor)
執(zhí)行一個先前由ora_parse函數(shù)解析過的查詢。
(6)boolean
ora_fetch(integer
cursor)
此函數(shù)會使得一個執(zhí)行過的查詢中的行被取到指示器中。這使得您可以調(diào)用ora_getcolumn函數(shù)。
(7)string
ora_getcolumn(integer
cursor,
integer
column)
返回當(dāng)前的值。列由零開始的數(shù)字索引。
(8)boolean
ora_logoff(integer
connection)
斷開對數(shù)據(jù)庫服務(wù)器的鏈接。
以下是向ORACLE數(shù)據(jù)庫插入數(shù)據(jù)的示例程序:
html
headtitle向ORACLE數(shù)據(jù)庫中插入數(shù)據(jù)/title/head
body
form
action="?echo
$PHP_SELF;?"
method="post"
table
border="1"
cellspacing="0"
cellpadding="0"
tr
thID/th
thname/th
thDescription/th
/tr
tr
tdinput
type="text"
name="name"
maxlength="50"
size="10"/td
tdinput
type="text"
name="email"
maxlength="255"
size="30"/td
tdinput
type="text"
name="Description"
maxlength="255"
size="50"/td
/tr
tr
align="center"
td
colspan="3"input
type="submit"
value="提交" input
type="reset"
value="重寫"/td
/tr
/table
/form
?
//先設(shè)置兩個環(huán)境變量ORACLE_HOME,ORACLE_SID
putenv("ORACLE_HOME=/oracle/app/oracle/product/8.0.4");
putenv("ORACLE_SID=ora8");
//設(shè)置網(wǎng)頁顯示中文
putenv("NLS_LANG=Simplified_Chinese.zhs16cgb231280");
if($connection=ora_logon("scott","tiger"))
{
//庫表test有ID,name,Description三項
$sql
=
'insert
into
test(ID,name,Description)
values
';
$sql
.=
'(''
.
$ID
.
'',''
.
$name
.
'',''.
$Description
.
'')';
if($cursor=ora_do($connect,$sql))
{
print("insert
finished!");
}
$query
=
'select
*
from
test';
if($cursor=ora_do($connect,$query))
{
ora_fetch($cursor);
$content0=ora_getcolumn($cursor,0);
$content1=ora_getcolumn($cursor,1);
$content2=ora_getcolumn($cursor,2);
print("$content0");
print("$content1");
print("$content2");
ora_close($cursor);
}
ora_logoff($connection);
}
?
/body
/html
要么在寫入數(shù)據(jù)庫前把圖片路徑補全,要么,就讀取后,補全路徑后再輸出,很簡單的做法
下面這個SQL語句可以查詢數(shù)據(jù)庫里面各個表的大小:
SHOW TABLE STATUS FROM 數(shù)據(jù)庫名
下面這個語句可以顯示數(shù)據(jù)庫的數(shù)據(jù)文件路徑(取消括號可以顯示許多信息):
show variables [like 'datadir']
補充:
上面兩個都是MYSQL的語句,與PHP無關(guān),你可以在MYSQL的管理工具里面執(zhí)行語句查看結(jié)果。如果你需要在PHP程序中獲取這些信息,你需要象獲取SELECT * FROM語句一樣做,一般有下列步驟:
mysql_connect(服務(wù)器,用戶,密碼);
if ($res=mysql_query("show variables like 'datadir'"))
{
$row=mysql_fetch_array($res);
mysql_free_result($res);
echo '數(shù)據(jù)庫路徑:'.$row[0];
}
mysql_close();
進入php源程序目錄中的ext目錄中,這里存放著各個擴展模塊的源代碼,選擇你需要的模塊,比如curl模塊:cd curl執(zhí)行phpize生成編譯文件!
phpize在PHP安裝目錄的bin目錄/usr/local/php5/bin/phpize運行時,
可能會報錯:Cannot find autoconf. Please check your autoconf installation andthe $PHP_AUTOCONFenvironment variable is set correctly and then rerun thisscript.,需要安裝autoconf:yum install autoconf(RedHat或者CentOS)、apt-get installautoconf(Ubuntu Linux)!
執(zhí)行/usr/local/php5/bin/php -v這個命令時,php會去檢查配置文件是否正確,
如果有配置錯誤,這里會報錯,可以根據(jù)錯誤信息去排查!
先用php把數(shù)據(jù)庫中的圖片路徑讀取出來,然后把這個路徑嵌入到img元素的src中,就相當(dāng)于把圖片的路徑轉(zhuǎn)化為圖片了。
?
SHOW TABLE STATUS FROM 數(shù)據(jù)庫名
下面這個語句可以顯示數(shù)據(jù)庫的數(shù)據(jù)文件路徑(取消括號可以顯示許多信息):
SHOW VARIABLES [LIKE 'DATADIR']補充:上面兩個都是MYSQL的語句,與PHP無關(guān),你可以在MYSQL的管理工具里面執(zhí)行語句查看結(jié)果。如果你需要在PHP程序中獲取這些信息,你需要象獲取SELECT * FROM語句一樣做,一般有下列步驟:
MYSQL_CONNECT(服務(wù)器,用戶,密碼);
網(wǎng)頁標(biāo)題:php調(diào)用數(shù)據(jù)庫的路徑,php 路徑
分享網(wǎng)址:http://chinadenli.net/article4/hsgjie.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、品牌網(wǎng)站制作、靜態(tài)網(wǎng)站、定制開發(fā)、外貿(mào)建站、虛擬主機
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)