当前位置: 首页>>代码示例>>PHP>>正文


PHP oci_fetch_assoc函数代码示例

本文整理汇总了PHP中oci_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_fetch_assoc函数的具体用法?PHP oci_fetch_assoc怎么用?PHP oci_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了oci_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSingleResult

 protected function getSingleResult($sql)
 {
     $statement = oci_parse($this->connection, $sql);
     oci_execute($statement);
     if ($result = oci_fetch_assoc($statement)) {
         oci_free_statement($statement);
         return $result;
     } else {
         oci_free_statement($statement);
         return NULL;
     }
 }
开发者ID:jamespaulmuir,项目名称:MIT-Mobile-Framework,代码行数:12,代码来源:tech_cash.php

示例2: dispCart

 function dispCart()
 {
     $cartLen = count($_SESSION['cart']);
     if ($cartLen < 1) {
         echo 'You have no items in your cart.<br><a href="main.php">Keep shopping</a><br>';
         die;
     }
     //for loop to iterate through cart items
     for ($i = 0; $i < $cartLen; $i++) {
         if ($cartLen > 0) {
             $newconn = conndb();
             //sql
             $s = oci_parse($newconn, "select * from PRODUCT where PRODUCTID=:pid_prefix");
             $plook = $_SESSION['cart'][$i]['productid'];
             oci_bind_by_name($s, ':pid_prefix', $plook);
             oci_execute($s);
             //fetch a single row depending on product id
             $res = oci_fetch_assoc($s);
             echo "Product name: ", $res['PRODUCTNAME'], " Price: ", $res['PRODUCTPRICE'];
             echo '<a href="cart.php?del=' . $i . '"> Remove item</a><br>';
         }
     }
     if ($cartLen > 0) {
         echo '<a href="checkout.php">Proceed to checkout</a><br>';
     }
 }
开发者ID:Emadbox,项目名称:eStore,代码行数:26,代码来源:cart.php

示例3: afficher_produit

function afficher_produit($is_fruit)
{
    if ($is_fruit) {
        $requete = "SELECT * FROM Produits WHERE `fruit`=1";
    } else {
        $requete = "SELECT * FROM Produits WHERE `fruit`=0";
    }
    $idcom = connex("Myparam");
    $stmt = oci_parse($idcom, $requete);
    $result = oci_execute($result, OCI_DEFAULT);
    if (!$result) {
        echo "Lecture impossible";
    } else {
        echo "<table cellspacing='0' cellpadding='5'>";
        echo "<tr>";
        echo "<th>Produit</th><th>Description</th><th>Stock</th><th>Prix</th><th>Quantité</th><th></th>";
        echo "</tr>";
        while ($ligne = oci_fetch_assoc($result)) {
            echo "<tr id='" . $ligne[0] . "'>";
            echo "<td>" . $ligne[1] . "</td>";
            echo "<td>" . $ligne[2] . "</td>";
            echo "<td>" . $ligne[3] . "</td>";
            echo "<td>" . $ligne[4] . "</td>";
            echo "<td><select name='qte_v[]'>";
            for ($i = 1; $i <= $ligne[3]; $i++) {
                echo "<option>" . $i . "</option>";
            }
            echo "</select></td>";
            echo '<td><button onclick="addProduit($(this));" class=bouton_produit>Ajouter au panier</button></td>';
            echo "</tr>";
        }
        echo "</table>";
    }
}
开发者ID:Athox,项目名称:Projet-PHP-Vente-Bio,代码行数:34,代码来源:produit.php

示例4: addTransport

function addTransport()
{
    global $con1;
    global $id;
    global $departmentId;
    global $transportTypeId;
    global $transportSubtypeId;
    global $model;
    global $gid;
    $query = "SELECT sq_request_all.nextval FROM DUAL";
    $statement = oci_parse($con1, $query);
    if (oci_execute($statement, OCI_DEFAULT)) {
        $res = oci_fetch_assoc($statement);
        $id = $res["NEXTVAL"];
    } else {
        $err = oci_error();
        die("Не удалось получить индентификатор : " . $err[message]);
        echo false;
    }
    $query2 = "INSERT INTO TRANSPORT_ITEMS(ITEM_ID, ITEM_TITLE, ITEM_GID, DEP_ID, ITEM_TYPE_ID, ITEM_SUBTYPE_ID)\n               VALUES({$id}, '{$model}', '{$gid}', {$departmentId}, {$transportTypeId}, {$transportSubtypeId})";
    $statement2 = oci_parse($con1, $query2);
    if (oci_execute($statement2, OCI_COMMIT_ON_SUCCESS)) {
        $query3 = "SELECT * FROM TRANSPORT_ITEMS WHERE ITEM_ID = {$id}";
        $statement3 = oci_parse($con1, $query3);
        if (oci_execute($statement3, OCI_DEFAULT)) {
            $transport = oci_fetch_assoc($statement3);
            echo json_encode($transport);
        }
    } else {
        $err = oci_error();
        die("Не удалось добавить транспорт: " . $err[message]);
        echo "fail";
    }
}
开发者ID:bdf2ch,项目名称:auto,代码行数:34,代码来源:transport.php

示例5: Query

 public function Query($query_string, $params = null)
 {
     ++self::$query_count;
     $this->qid = $this->prepareSQL($query_string, $params);
     $result = oci_execute($this->qid);
     $this->row = 0;
     $this->selected_rows = null;
     $err = oci_error($this->qid);
     $this->error = $err['message'];
     $this->errno = $err['code'];
     if (oci_statement_type($this->qid) == 'SELECT') {
         $this->records = array();
         $this->selected_rows = 0;
         $this->current_row = 0;
         while ($row = @oci_fetch_assoc($this->qid)) {
             $this->records[] = $row;
             ++$this->selected_rows;
         }
     }
     if (!$result) {
         throw new Exception('Invalid query: ' . $query_string . ': ' . $this->error, $this->errno);
     }
     //if
     return $result;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:25,代码来源:class.dbdriveroracle.php

示例6: getUserForID

 function getUserForID($userId)
 {
     $user = new User();
     ini_set('display_errors', 'On');
     $db = "w4111c.cs.columbia.edu:1521/adb";
     $conn = oci_connect("kpg2108", "test123", $db);
     $stmt = oci_parse($conn, "select * from users where user_Id='" . $userId . "'");
     $rows = oci_execute($stmt);
     oci_close($conn);
     while ($row = oci_fetch_assoc($stmt)) {
         echo $row['LOGIN_ID'];
         $user->setUserId($row['USER_ID']);
         $user->setPassword($row['PASSWORD']);
         $user->setFirstName($row['FNAME']);
         $user->setLastName($row['LNAME']);
         $user->setLoginId($row['LOGIN_ID']);
         $user->setEmailId($row['EMAIL_ID']);
         $user->setAddress($row['ADDRESS']);
         $user->setPhoneNumber($row['PHONE_NO']);
         $user->setSecurityAnswer($row['ANSWER']);
         $user->setSecurityQuestion($row['QUESTION']);
         $user->setMiles($row['MILES']);
     }
     return $user;
 }
开发者ID:NLP-Project,项目名称:AirLine-Reservation-System,代码行数:25,代码来源:UserAccountModel.php

示例7: fetchAssoc

 public function fetchAssoc()
 {
     set_error_handler(static::getErrorHandler());
     $row = oci_fetch_assoc($this->resource);
     restore_error_handler();
     return $row;
 }
开发者ID:jpina,项目名称:oci8,代码行数:7,代码来源:Oci8Statement.php

示例8: get_next

 public function get_next($res)
 {
     $data = oci_fetch_assoc($res);
     if (array_key_exists("VALUE", $data)) {
         $data["value"] = $data["VALUE"];
     }
     return $data;
 }
开发者ID:tmlsoft,项目名称:main,代码行数:8,代码来源:db_oracle.php

示例9: fetchDateFormat

 protected function fetchDateFormat()
 {
     $sql = "select value from v\$nls_parameters where parameter = 'NLS_DATE_FORMAT'";
     $query = oci_parse($this->conn->getResource(), $sql);
     oci_execute($query);
     $row = oci_fetch_assoc($query);
     oci_free_statement($query);
     return $row['VALUE'];
 }
开发者ID:winkbrace,项目名称:oracle,代码行数:9,代码来源:ConnectionTest.php

示例10: cari_tgl_pengangkatan

function cari_tgl_pengangkatan($nid)
{
    $sql = "SELECT  HIRE_DATE\n\t\t\tFROM " . $USERPAYROLL . ".EMP_DETAIL \n\t\t\tWHERE NID = '{$nid}'\n\t\t\t";
    $stmt = oci_parse($conn, $sql) or die("Query gagal");
    oci_execute($stmt);
    $row = oci_fetch_assoc($stmt);
    $tgl = $row['HIRE_DATE'];
    return $tgl;
}
开发者ID:erikhard,项目名称:egratifikasi,代码行数:9,代码来源:format_tanggal.php

示例11: fetch_next

 private function fetch_next()
 {
     if ($row = oci_fetch_assoc($this->stmt)) {
         $row = array_change_key_case($row, CASE_LOWER);
         unset($row['oracle_rownum']);
         array_walk($row, array('oci_native_moodle_database', 'onespace2empty'));
     }
     return $row;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:9,代码来源:oci_native_moodle_recordset.php

示例12: findOne

 public function findOne($tSql, $sClassRow)
 {
     $pRs = $this->query($this->bind($tSql));
     if (empty($pRs)) {
         return null;
     }
     $tRow = oci_fetch_assoc($pRs);
     $oRow = new $sClassRow($tRow);
     return $oRow;
 }
开发者ID:clavat,项目名称:mkframework,代码行数:10,代码来源:sgbd_oracle.php

示例13: count

 function count()
 {
     $stmt = clone $this;
     $stmt->sql = "SELECT COUNT(*) AS THEROWC FROM ({$this->sql})";
     $stmt->hasChanged = true;
     $queryId = $stmt->execute();
     $row = oci_fetch_assoc($queryId);
     $stmt->free();
     return $row['THEROWC'];
 }
开发者ID:knevcher,项目名称:limb,代码行数:10,代码来源:lmbOciQueryStatement.class.php

示例14: get_next

 public function get_next($res)
 {
     $data = oci_fetch_assoc($res);
     if ($data) {
         foreach ($data as $k => $v) {
             $data[strtolower($k)] = $v;
         }
     }
     return $data;
 }
开发者ID:jekay100,项目名称:xwtec,代码行数:10,代码来源:db_oracle.php

示例15: AchatProduit

function AchatProduit()
{
    $conn = oci_connect("SYSTEM", "azerty", "//localhost/XE");
    $select_stmt2 = "SELECT * FROM ALEXIS.AUTEUR";
    $stid = oci_parse($conn, $select_stmt2);
    $result = oci_execute($stid);
    while ($ligne2 = oci_fetch_assoc($stid)) {
        echo '<li><a href="#">' . $ligne2['PRENOM_AUTEUR'] . " " . $ligne2["NOM_AUTEUR"] . "</a></li>";
    }
    oci_free_statement($stid);
}
开发者ID:Avisacha,项目名称:projetOracle,代码行数:11,代码来源:Index.php


注:本文中的oci_fetch_assoc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。