1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      php調(diào)用數(shù)據(jù)庫信息,php如何調(diào)用數(shù)據(jù)庫

      PHP調(diào)用三種數(shù)據(jù)庫的方法(3)

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

      創(chuàng)新互聯(lián)專注于光山網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供光山營銷型網(wǎng)站建設(shè),光山網(wǎng)站制作、光山網(wǎng)頁設(shè)計(jì)、光山網(wǎng)站官網(wǎng)定制、微信小程序開發(fā)服務(wù),打造光山網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供光山網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

      (1)integer

      ora_logon(string

      user

      ,

      string

      password)

      開始對(duì)一個(gè)Oracle數(shù)據(jù)庫服務(wù)器的連接。

      (2)integer

      ora_open(integer

      connection)

      打開給出的連接的游標(biāo)。

      (3)integer

      ora_do(integer

      connection,

      string

      query)

      在給出的連接上執(zhí)行查詢。PHP生成一個(gè)指示器,解析查詢,并執(zhí)行之。

      (4)integer

      ora_parse(integer

      cursor,

      string

      query)

      解析一個(gè)查詢并準(zhǔn)備好執(zhí)行。

      (5)boolean

      ora_exec(integer

      cursor)

      執(zhí)行一個(gè)先前由ora_parse函數(shù)解析過的查詢。

      (6)boolean

      ora_fetch(integer

      cursor)

      此函數(shù)會(huì)使得一個(gè)執(zhí)行過的查詢中的行被取到指示器中。這使得您可以調(diào)用ora_getcolumn函數(shù)。

      (7)string

      ora_getcolumn(integer

      cursor,

      integer

      column)

      返回當(dāng)前的值。列由零開始的數(shù)字索引。

      (8)boolean

      ora_logoff(integer

      connection)

      斷開對(duì)數(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è)置兩個(gè)環(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三項(xiàng)

      $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

      php如何獲取數(shù)據(jù)庫信息

      代碼如下:?View

      Code

      PHP

      include("conn.php");//調(diào)用數(shù)據(jù)庫連接文件

      echo

      "table

      width=572

      height=56

      border=0

      cellspacing=1

      ";

      //創(chuàng)建html表格

      echo

      "tr

      bgcolor=#9999FF";

      echo

      "th

      width=33

      scope=colid/th";

      echo

      "th

      width=100

      scope=coluser_name/th

      ";

      echo

      "th

      width=100

      scope=coluser_pass/th

      ";

      echo

      "th

      width=100

      scope=colstaus/th";

      echo

      "th

      width=100

      scope=colinsert_time/th";

      echo

      "/tr";

      $SQL

      =

      "select

      *

      from

      user_info";

      $query

      =

      mysql_query($SQL);

      //SQL查詢語句

      while

      ($row

      =

      mysql_fetch_array($query)){

      //使用while循環(huán)mysql_fetch_array()并將數(shù)據(jù)返回?cái)?shù)組

      echo

      "tr

      onmouseout=this.style.backgroundColor=''

      onMouseOver=this.style.backgroundColor='#99CC33'

      bgcolor=#CCCCCC";

      echo

      "td$row[0]/td";

      //輸出數(shù)組中數(shù)據(jù)

      echo

      "td$row[1]/td";

      echo

      "td$row[2]/td";

      echo

      "td$row[3]/td";

      echo

      "td$row[4]/td";

      echo

      "/tr";

      }

      echo

      "/table";輸出記錄截圖

      php讀取數(shù)據(jù)庫信息的幾種方法

      連接到一個(gè)?url?地址為localhost?、?端口為?3306?的mysql服務(wù)器上。mysql服務(wù)器的帳號(hào)是"root",密碼是"9999"。mysql?服務(wù)器上有一個(gè)數(shù)據(jù)庫?ok?,?數(shù)據(jù)庫里有一個(gè)表?abc。表?abc?一共為兩列,列名分別是?"id"?和?"name"?,將?abc?里的所有數(shù)據(jù)讀出來。

      ??

      $dbh?=?@mysql_connect("localhost:3306","root","9999");?

      /*?定義變量dbh?,?mysql_connect()函數(shù)的意思是連接mysql數(shù)據(jù)庫,?"@"的意思是屏蔽報(bào)錯(cuò)?*/?

      if(!$dbh){die("error");}?

      /*?die()函數(shù)的意思是將括號(hào)里的字串送到瀏覽器并中斷PHP程式?(Script)。括號(hào)里的參數(shù)為欲送出的字串。?*/?

      @mysql_select_db("ok",?$dbh);?

      /*?選擇mysql服務(wù)器里的一個(gè)數(shù)據(jù)庫,這里選的數(shù)據(jù)庫名為?ok?*/?

      $q?=?"SELECT?*?FROM?abc";?

      /*?定義變量q,?"SELECT?*?FROM?abc"是一個(gè)SQL語句,意思是讀取表abc中的數(shù)據(jù)?*/?

      ??

      br?/?

      !--=========?方法一?=========--?

      br?/?

      ??

      $rs?=?mysql_query($q,?$dbh);?

      /*?定義變量?rs?,函數(shù)mysql_query()的意思是:送出?query?字串供?MySQL?做相關(guān)的處理或者執(zhí)行.由于php是從右往左執(zhí)行的,所以,rs的值是服務(wù)器運(yùn)行mysql_query()函數(shù)后返回的值?*/?

      if(!$rs){die("Valid?result!");}?

      echo?"table";?

      echo?"trtdID/tdtdName/td/tr";?

      while($row?=?mysql_fetch_row($rs))?echo?"trtd$row[0]/tdtd$row[1]/td/tr";?

      /*?定義量變(數(shù)組)row,并利用while循環(huán),把數(shù)據(jù)一一寫出來.??

      函數(shù)mysql_fetch_row()的意思是:將查詢結(jié)果$rs單列拆到陣列變數(shù)中.??

      $row[0]?和?$row[1]?的位置可以換*/?

      echo?"/table";?

      ??

      br?/?

      !--=========?方法二?=========--?

      br?/?

      ??

      $rs?=?mysql_query($q,?$dbh);?

      while($row?=?mysql_fetch_object($rs))?echo?"$row-id?$row-name?br?/";?

      /*?id和name可以換位置?*/?

      ??

      br?/?

      !--=========?方法三?=========--?

      br?/?

      ??

      $rs?=?mysql_query($q,?$dbh);?

      while($row?=?mysql_fetch_array($rs))?echo?"$row[id]?$row[name]?br?/";?

      /*?id和name可以換位置?*/?

      ??

      !--=========?方法三最快?=========--?

      ??

      @mysql_close($dbh);?

      /*?關(guān)閉到mysql數(shù)據(jù)庫的連接?*/?

      ?


      網(wǎng)頁標(biāo)題:php調(diào)用數(shù)據(jù)庫信息,php如何調(diào)用數(shù)據(jù)庫
      轉(zhuǎn)載注明:http://ef60e0e.cn/article/hociis.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        乃东县| 连州市| 天津市| 太和县| 资讯 | 历史| 汝城县| 历史| 临城县| 乌兰县| 嘉祥县| 安宁市| 湖北省| 进贤县| 额济纳旗| 威信县| 新和县| 扶绥县| 海兴县| 蕲春县| 长岭县| 滁州市| 鄱阳县| 桃江县| 呼和浩特市| 通河县| 阿拉善盟| 福清市| 前郭尔| 区。| 涿鹿县| 西乌珠穆沁旗| 津南区| 乌拉特前旗| 江津市| 台湾省| 夏津县| 米泉市| 基隆市| 响水县| 武鸣县|