本文整理汇总了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;
}
}
示例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>';
}
}
示例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>";
}
}
示例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";
}
}
示例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;
}
示例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;
}
示例7: fetchAssoc
public function fetchAssoc()
{
set_error_handler(static::getErrorHandler());
$row = oci_fetch_assoc($this->resource);
restore_error_handler();
return $row;
}
示例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;
}
示例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'];
}
示例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;
}
示例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;
}
示例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;
}
示例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'];
}
示例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;
}
示例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);
}