本文整理汇总了PHP中OCIFetch函数的典型用法代码示例。如果您正苦于以下问题:PHP OCIFetch函数的具体用法?PHP OCIFetch怎么用?PHP OCIFetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OCIFetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_ams_student
public function get_ams_student($student_id = NULL)
{
$conn = oci_connect('AMS_QUERIES', 'Oo_Hecha1_rohm3', '//192.168.170.171:1522/ACADEMIC');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else {
if ($student_id == NULL) {
$sql = "SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS";
} else {
$sql = 'SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS WHERE STUDENT_NO LIKE \'%' . $student_id . '%\'';
}
$rs4 = oci_parse($conn, $sql);
oci_execute($rs4);
$rows = oci_num_rows($rs4);
$t = 0;
while (OCIFetch($rs4)) {
$t++;
$name1 = ociresult($rs4, "SURNAME");
$dob = ociresult($rs4, "DOB");
$gender = ociresult($rs4, "GENDER");
$oname1 = ociresult($rs4, "OTHER_NAMES");
$STUDENT_NO = ociresult($rs4, "STUDENT_NO");
$COURSES = ociresult($rs4, "COURSES");
$GUARDIAN_NAME1 = ociresult($rs4, "GUARDIAN_NAME");
$MOBILE_NO = ociresult($rs4, "MOBILE_NO");
$EMAIL = ociresult($rs4, "EMAIL");
$FACULTIES = ociresult($rs4, "FACULTIES");
// details to be saved
$name = str_replace("'", "", "{$name1}");
$oname = str_replace("'", "", "{$oname1}");
$GUARDIAN_NAME = str_replace("'", "", "{$GUARDIAN_NAME1}");
if (!empty($STUDENT_NO)) {
$exists = $this->student_exists($STUDENT_NO);
$data = array('title' => '', 'Surname' => $name, 'Other_names' => $oname, 'DOB' => $dob, 'contact' => $MOBILE_NO, 'gender' => $gender, 'student_Number' => $STUDENT_NO, 'courses' => $FACULTIES, 'GUARDIAN_NAME' => $GUARDIAN_NAME, 'faculty' => $FACULTIES);
if (!$exists) {
$this->db->insert('student', $data);
} else {
$this->db->where('student_Number', $STUDENT_NO);
$this->db->update('student', $data);
}
$date = date("Y-m-d H:i:s");
// data for patients patient date, visit type, strath number created by and modified by fields
if ($student_id != NULL) {
$patient_data = array('patient_number' => $this->create_patient_number(), 'patient_date' => $date, 'visit_type_id' => 1, 'strath_no' => $STUDENT_NO, 'created_by' => $this->session->userdata('personnel_id'), 'modified_by' => $this->session->userdata('personnel_id'));
$this->db->insert('patients', $patient_data);
return $this->db->insert_id();
}
} else {
$this->session->set_userdata("error_message", "Student could not be found");
return FALSE;
}
}
if ($student_id != NULL) {
return TRUE;
}
}
}
示例2: ociparse
print "<center><A HREF=\"frame02.php\" target=\"principal\"><IMG SRC=\"img/volta.gif\" alt=\"Retorna à Página Anterior\" BORDER=0></a></center>";
}
if ($aocobrarco == 'S') {
print "<center><A HREF=\"consultit.php\" target=\"guia\"><IMG SRC=\"img/volta.gif\" alt=\"Retorna à Página Anterior\" BORDER=0></a></center>";
}
}
}
if ($nrsequencia == '0') {
if ($nrunimed == '127') {
$stmt9 = ociparse($conn, "SELECT CDSERVICO FROM (SELECT CDSERVICO FROM SERVICO_ESPECIALISTA WHERE NRREGISTRO_PREST = '{$result1}' AND CDESPECIALIDADE = '{$cdespecial}' AND CDSERVICO LIKE '0001%' AND (AOEXCLUSAO IS NULL OR AOEXCLUSAO = 'N')) WHERE ROWNUM = '1'");
} else {
$stmt9 = ociparse($conn, "SELECT CDSERVICO FROM(\n SELECT 1 A, CDSERVICO FROM SERVICO_ESPECIALISTA\n WHERE NRREGISTRO_PREST = '{$result1}'\n AND CDESPECIALIDADE = '{$cdespecial}' AND AOSERVICO_CONSULTA = 'S'\n UNION\n SELECT 2 A, CDSERVICO FROM SERVICO_ESPECIALIDADE\n WHERE CDESPECIALIDADE = '{$cdespecial}' AND AOSERVICO_CONSULTA = 'S'\n UNION\n SELECT 3 A, VLPARAMETRO CDSERVICO FROM PARAMETRO\n WHERE CDPARAMETRO = 'SERVCONS')\n WHERE ROWNUM = '1'\n ORDER BY A\n ");
}
OCIdefineByName($stmt9, "cdservico", $cdservico);
OCIexecute($stmt9);
OCIFetch($stmt9);
$result4 = OCIResult($stmt9, 1);
OCIFreeStatement($stmt9);
}
print "<center><form onSubmit=\"return disableForm(this);\" action=\"servc.php?btnptu={$btnptu}\" method=\"POST\" name=\"digitsv\">";
//if (!($sv != !1 and $qt != !1)&&($funcionario == 'AUTOWEB')) {
if (!($sv != !1 and $qt != !1)) {
//RAMON
include "maecad.php";
include "cpfcad.php";
//RAMON
}
if ($nrsequencia == '0') {
echo "<img src=\"img/barra.jpg\" width=\"603\" height=\"3\"><br>\n <font class='nome_campo'>Código: </font>\n <input onKeyUp=\"return autoTab(this, 8, event);\"\n type=\"text\" size=\"8\" maxlength=\"8\"\n name=\"sv\"\n onBlur=\"chkcampo(this,this.value);\"\n value=\"";
if ($result4 != !1) {
echo $result4;
示例3: tableInfo
/**
* Returns information about a table or a result set.
*
* NOTE: only supports 'table' and 'flags' if <var>$result</var>
* is a table name.
*
* NOTE: flags won't contain index information.
*
* @param object|string $result MDB2_result object from a query or a
* string containing the name of a table
* @param int $mode a valid tableInfo mode
* @return array an associative array with the information requested
* or an error object if something is wrong
* @access public
* @internal
* @see MDB2_Driver_Common::tableInfo()
*/
function tableInfo($result, $mode = null)
{
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
if ($db->options['portability'] & MDB2_PORTABILITY_LOWERCASE) {
$case_func = 'strtolower';
} else {
$case_func = 'strval';
}
if (is_string($result)) {
/*
* Probably received a table name.
* Create a result resource identifier.
*/
if (MDB2::isError($connect = $db->connect())) {
return $connect;
}
$result = strtoupper($result);
$q_fields = 'SELECT column_name, data_type, data_length, ' . 'nullable ' . 'FROM user_tab_columns ' . "WHERE table_name='{$result}' ORDER BY column_id";
$db->last_query = $q_fields;
if (!($stmt = @OCIParse($db->connection, $q_fields))) {
return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA);
}
if (!@OCIExecute($stmt, OCI_DEFAULT)) {
return $db->raiseError($stmt);
}
$i = 0;
while (@OCIFetch($stmt)) {
$res[$i]['table'] = $case_func($result);
$res[$i]['name'] = $case_func(@OCIResult($stmt, 1));
$res[$i]['type'] = @OCIResult($stmt, 2);
$res[$i]['len'] = @OCIResult($stmt, 3);
$res[$i]['flags'] = @OCIResult($stmt, 4) == 'N' ? 'not_null' : '';
if ($mode & MDB2_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
$i++;
}
if ($mode) {
$res['num_fields'] = $i;
}
@OCIFreeStatement($stmt);
} else {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->getResource();
if (empty($id)) {
return $db->raiseError();
}
# if ($result === $db->last_stmt) {
$count = @OCINumCols($id);
for ($i = 0; $i < $count; $i++) {
$res[$i]['table'] = '';
$res[$i]['name'] = $case_func(@OCIColumnName($id, $i + 1));
$res[$i]['type'] = @OCIColumnType($id, $i + 1);
$res[$i]['len'] = @OCIColumnSize($id, $i + 1);
$res[$i]['flags'] = '';
if ($mode & MDB2_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
if ($mode) {
$res['num_fields'] = $i;
}
# } else {
# return $db->raiseError(MDB2_ERROR_NOT_CAPABLE);
# }
}
return $res;
}
示例4: while
<input id="Segundo apellido" name="Segundo_apellido" value="" type="text" placeholder="Segundo Apellido" required ><br>
</label>
</br></br>
<?php
echo "<select name=\"combo_genero\">";
while (OCIFetch($array_GENERO)) {
$campo_GENERO = OCIResult($array_GENERO, 2);
//aca va la columna
echo "<option value=\"{$campo_GENERO}\">{$campo_GENERO}</option>";
}
echo "</select>";
?>
</td>
<td><?php
echo "<select name=\"combo_CIUDAD\">";
while (OCIFetch($array_CIUDAD)) {
$campo_CIUDAD = OCIResult($array_CIUDAD, 2);
//aca va la columna
echo "<option value=\"{$campo_CIUDAD}\">{$campo_CIUDAD}</option>";
}
echo "</select>";
?>
</td>
<br>
<label class="email">
<span>Email</span><br>
<input id="password" name="password" value="" type="password" placeholder="Email" required><br>
</label>
<label class="password">
<span>Contraseña</span><br>
<input id="password" name="password" value="" type="password" placeholder="Contraseña" required><br>
示例5: max
$iserror = true;
}
// end if
if (!$iserror) {
require_once 'inc/dbconnect.php';
global $db;
// count the record in plants table and use id number $count+1 for the new record
$query_count = "SELECT max(ID) FROM accounts";
/* check the sql statement for errors and if errors report them */
$stmt = OCIParse($db, $query_count);
if (!$stmt) {
echo "An error occurred in parsing the sql string.\n";
exit;
}
OCIExecute($stmt);
if (OCIFetch($stmt)) {
$count = OCIResult($stmt, 1);
//returns the data for column 1
//echo $count."</br>";
} else {
echo "An error occurred in retrieving account id.\n";
exit;
}
$count++;
// build INSERT query
$query = "INSERT INTO accounts ( ID, Username, Password, Email, Phone, Address, City, Postcode ) " . "VALUES ( {$count}, '{$uname}', '{$pword}', '{$email}', " . "'" . quotemeta($phone) . "', '{$address}', '{$city}', '{$postcode}' )";
//echo "$query";
/* check the sql statement for errors and if errors report them */
$stmt = OCIParse($db, $query);
//echo "SQL: $query<br>";
if (!$stmt) {
示例6: sql_rowseek
function sql_rowseek($rownum, $query_id = 0)
{
if (!$query_id) {
$query_id = $this->query_result;
}
if ($query_id) {
@OCIExecute($query_id, OCI_DEFAULT);
for ($i = 0; $i < $rownum; $i++) {
@OCIFetch($query_id);
}
$result = @OCIFetch($query_id);
return $result;
} else {
return false;
}
}
示例7: OCIParse
if (!$connect) {
echo "<br />There was an error connecting to the database.";
exit;
}
$query = "select * from book_table where unit_code = '{$unit_code}'";
$stmt = OCIParse($connect, $query);
if (!$stmt) {
echo "An error occured in parsing the sql string.\n";
exit;
}
OCIExecute($stmt);
?>
<table>
<?php
while (OCIFetch($stmt)) {
echo "<tr>";
echo "<td>IBSN</td>";
$fg1 = OCIResult($stmt, "IBSN");
echo "<td>";
echo $fg1;
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Title</td>";
$fg2 = OCIResult($stmt, "TITLE");
echo "<td>";
echo $fg2;
echo "</td>";
echo "</tr>";
echo "<tr>";
示例8: LimitQuery
function LimitQuery($query, $offset, $rows)
{
$this->FreeResult();
$this->oid = 0;
$this->cur = -1;
$this->vcur = -1;
$this->Record = array();
if ($this->conn) {
if (!($this->res = OCIParse($this->conn, $query))) {
trigger_error("Error parsing query: {$query}");
return $this->ReportError($this->conn);
}
if (OCIExecute($this->res)) {
$this->cur = 0;
// Push cursor to appropriate row in case next_record() is used
while ($this->cur < $offset) {
OCIFetch($this->res);
$this->cur++;
}
$this->vcur = $offset + $rows - 1;
return $this->res;
} else {
trigger_error("Error executing query: {$query}");
return -1;
}
} else {
return -1;
}
}
示例9: htmlentities
print htmlentities($e['message']);
exit;
}
// create SQL statement
$sql = "Select * from Classes";
// parse SQL statement
$sql_statement = OCIParse($conn, $sql);
// execute SQL query
OCIExecute($sql_statement);
// get number of columns for use later
$num_columns = OCINumCols($sql_statement);
// start results formatting
echo "<TABLE BORDER=1>";
echo "<TR><TH>SCU Core Class</TH><TH>Alternate Class</TH><TH>University</TH></TR>";
// format results by row
while (OCIFetch($sql_statement)) {
echo "<TR>";
for ($i = 1; $i <= $num_columns; $i++) {
$column_value = OCIResult($sql_statement, $i);
echo "<TD>{$column_value}</TD>";
}
echo "</TR>";
}
echo "</TABLE>";
OCIFreeStatement($sql_statement);
OCILogoff($conn);
?>
<html>
<head>
<title>Step 1</title>
</head>
示例10: SkipFirstRows
function SkipFirstRows($result)
{
$result_value = intval($result);
$first = $this->limits[$result_value][0];
for (; $this->limits[$result_value][2] < $first; $this->limits[$result_value][2]++) {
if (!OCIFetch($result)) {
$this->limits[$result_value][2] = $first;
return $this->SetError("Skip first rows", "could not skip a query result row");
}
}
return 1;
}
示例11: while
?>
</td>
<td><?php
echo "<select MULTIPLE name=\"combo_CATEGORIA_INTERES\">";
while (OCIFetch($array_CATEGORIA_INTERES)) {
$campo_CATEGORIA_INTERES = OCIResult($array_CATEGORIA_INTERES, 2);
//aca va la columna
echo "<option value=\"{$campo_CATEGORIA_INTERES}\">{$campo_CATEGORIA_INTERES}</option>";
}
echo "</select>";
?>
</td>
<td>
<?php
echo "<select MULTIPLE name=\"combo_prueba\">";
while (OCIFetch($array_INTERES)) {
$campo_interes = OCIResult($array_INTERES, 2);
//aca va la columna
echo "<option value=\"{$campo_interes}\">{$campo_interes}</option>";
}
echo "</select>";
?>
</td>
</table>
<br>
<b>Mascotas:</b> <br> <br>
Gato:
<select>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
示例12: F_OCIFetch
function F_OCIFetch($Res)
{
return OCIFetch($Res);
}
示例13: readCart
function readCart()
{
global $db;
global $grandtotal;
$cart = $_SESSION['cart'];
if ($cart) {
$items = explode(',', $cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = isset($contents[$item]) ? $contents[$item] + 1 : 1;
}
$output[] = '<table class="cart_table">';
$output[] = '<tr class="cart_title">';
$output[] = '<td>Book name</td><td>Unit price</td><td>Qty</td><td>Total</td>';
$output[] = '</tr>';
foreach ($contents as $id => $qty) {
$sql = 'SELECT * FROM books WHERE id = ' . $id;
$stmt = OCIParse($db, $sql);
if (!$stmt) {
echo "An error occurred in parsing the sql string.\n";
exit;
}
OCIExecute($stmt);
while (OCIFetch($stmt)) {
$title = OCIResult($stmt, "TITLE");
$author = OCIResult($stmt, "AUTHOR");
$price = OCIResult($stmt, "PRICE");
$id = OCIResult($stmt, "ID");
}
// calculate gst and shipping
$gst = 0.1;
$price = $price + $price * $gst;
$price = number_format($price, 2);
$subtotal = number_format($price * $qty, 2);
$shipping += 4.95 * $qty;
$total += $subtotal + $shipping;
// display items in cart
$output[] = '<tr>';
$output[] = '<td>' . $title . '</td>';
$output[] = '<td>$' . $price . '</td>';
$output[] = '<td>' . $qty . '</td>';
$output[] = '<td>$' . $subtotal . '</td>';
$output[] = '</tr>';
}
// set global totals to use in session
$grandtotal = number_format($total, 2);
$_SESSION['grandtotal'] = $grandtotal;
// display shipping
$totalshipping = number_format($shipping, 2);
$output[] = '<tr>';
$output[] = '<td colspan="3" class="cart_total"><span class="red">TOTAL SHIPPING:</span></td>';
$output[] = '<td>$' . $totalshipping . '</td>';
$output[] = '</tr>';
// display total
$output[] = '<tr>';
$output[] = '<td colspan="3" class="cart_total"><span class="red">GRAND TOTAL:</span></td>';
$output[] = '<td>$' . $grandtotal . '</td>';
$output[] = '</tr>';
$output[] = '</table>';
} else {
$output[] = '<p>Your shopping cart is empty.<br />Order books by selecting the <strong>Order Now</strong> button when viewing book details.</p>';
$grandtotal = 0;
}
return join('', $output);
}
示例14: tableInfo
function tableInfo($result, $mode = null)
{
$count = 0;
$res = array();
/*
* depending on $mode, metadata returns the following values:
*
* - mode is false (default):
* $res[]:
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["nullable"] field can be null (boolean)
* [0]["format"] field precision if NUMBER
* [0]["default"] field default value
*
* - mode is DB_TABLEINFO_ORDER
* $res[]:
* ["num_fields"] number of fields
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["nullable"] field can be null (boolean)
* [0]["format"] field precision if NUMBER
* [0]["default"] field default value
* ['order'][field name] index of field named "field name"
* The last one is used, if you have a field name, but no index.
* Test: if (isset($result['order']['myfield'])) { ...
*
* - mode is DB_TABLEINFO_ORDERTABLE
* the same as above. but additionally
* ["ordertable"][table name][field name] index of field
* named "field name"
*
* this is, because if you have fields from different
* tables with the same field name * they override each
* other with DB_TABLEINFO_ORDER
*
* you can combine DB_TABLEINFO_ORDER and
* DB_TABLEINFO_ORDERTABLE with DB_TABLEINFO_ORDER |
* DB_TABLEINFO_ORDERTABLE * or with DB_TABLEINFO_FULL
*/
// if $result is a string, we collect info for a table only
if (is_string($result)) {
$result = strtoupper($result);
$q_fields = "select column_name, data_type, data_length, data_precision,\n nullable, data_default from user_tab_columns\n where table_name='{$result}' order by column_id";
if (!($stmt = OCIParse($this->connection, $q_fields))) {
return $this->oci8RaiseError();
}
if (!OCIExecute($stmt, OCI_DEFAULT)) {
return $this->oci8RaiseError($stmt);
}
while (OCIFetch($stmt)) {
$res[$count]['table'] = $result;
$res[$count]['name'] = @OCIResult($stmt, 1);
$res[$count]['type'] = @OCIResult($stmt, 2);
$res[$count]['len'] = @OCIResult($stmt, 3);
$res[$count]['format'] = @OCIResult($stmt, 4);
$res[$count]['nullable'] = @OCIResult($stmt, 5) == 'Y' ? true : false;
$res[$count]['default'] = @OCIResult($stmt, 6);
if ($mode & DB_TABLEINFO_ORDER) {
$res['order'][$res[$count]['name']] = $count;
}
if ($mode & DB_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$count]['table']][$res[$count]['name']] = $count;
}
$count++;
}
$res['num_fields'] = $count;
@OCIFreeStatement($stmt);
} else {
// else we want information about a resultset
if ($result === $this->last_stmt) {
$count = @OCINumCols($result);
for ($i = 0; $i < $count; $i++) {
$res[$i]['name'] = @OCIColumnName($result, $i + 1);
$res[$i]['type'] = @OCIColumnType($result, $i + 1);
$res[$i]['len'] = @OCIColumnSize($result, $i + 1);
$q_fields = "select table_name, data_precision, nullable, data_default from user_tab_columns where column_name='" . $res[$i]['name'] . "'";
if (!($stmt = OCIParse($this->connection, $q_fields))) {
return $this->oci8RaiseError();
}
if (!OCIExecute($stmt, OCI_DEFAULT)) {
return $this->oci8RaiseError($stmt);
}
OCIFetch($stmt);
$res[$i]['table'] = OCIResult($stmt, 1);
$res[$i]['format'] = OCIResult($stmt, 2);
$res[$i]['nullable'] = OCIResult($stmt, 3) == 'Y' ? true : false;
$res[$i]['default'] = OCIResult($stmt, 4);
OCIFreeStatement($stmt);
if ($mode & DB_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & DB_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
//.........这里部分代码省略.........
示例15: while
}
echo "</select>";
?></td>
<td><?php
echo "<select MULTIPLE name=\"combo_CATEGORIA_INTERES\">";
while (OCIFetch($array_CATEGORIA_INTERES))//Ciclo para recorrer la tabla
{
$campo_CATEGORIA_INTERES=OCIResult($array_CATEGORIA_INTERES,2);//aca va la columna
echo "<option value=\"$campo_CATEGORIA_INTERES\">$campo_CATEGORIA_INTERES</option>";
}
echo "</select>";
?></td>
<td>
<?php
echo "<select MULTIPLE name=\"combo_prueba\">";
while (OCIFetch($array_INTERES))//Ciclo para recorrer la tabla
{
$campo_interes=OCIResult($array_INTERES,2);//aca va la columna
echo "<option value=\"$campo_interes\">$campo_interes</option>";
}
echo "</select>";
?>
</td>
</table>
<br>
<b>Mascotas:</b> <br> <br>
Gato:
<select>
<option value="0">0</option>