Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP Manual > oci_fetch_array - Returns the next row from the result data as an associative or numeric array, or both





ลองใช้ค้นหาข้อมูล


   
Bookmark.

oci_fetch_array

(PHP 5, PECL oci8:1.1-1.2.4)

oci_fetch_arrayReturns the next row from the result data as an associative or numeric array, or both

Description

array oci_fetch_array ( resource $statement [, int $mode ] )

Returns an array, which corresponds to the next result row.

For details on the data type mapping performed by the oci8 driver, see the datatypes supported by the driver

It should be mentioned here, that oci_fetch_array() is insignificantly slower, than oci_fetch_row(), but much more handy.

Parameters

statement

A valid OCI statement identifier.

statement

An optional second parameter can be any combination of the following constants:

  • OCI_BOTH - return an array with both associative and numeric indices (the same as OCI_ASSOC + OCI_NUM). This is the default behavior.
  • OCI_ASSOC - return an associative array (as oci_fetch_assoc() works).
  • OCI_NUM - return a numeric array, (as oci_fetch_row() works).
  • OCI_RETURN_NULLS - create empty elements for the NULL fields.
  • OCI_RETURN_LOBS - return the value of a LOB of the descriptor.
Default mode is OCI_BOTH.

Return Values

Returns an array with both associative and numeric indices, or FALSE if there are no more rows in the statement .

Note: This function sets NULL fields to the PHP NULL value.

Note: Oracle returns all field names in uppercase and associative indices in the result array will be uppercased too.

Examples

Example #1 oci_fetch_array() with OCI_BOTH example

<?php
$connection 
oci_connect("apelsin""kanistra");

$query "SELECT id, name FROM fruits";

$statement oci_parse ($connection$query);
oci_execute ($statement);

while (
$row oci_fetch_array ($statementOCI_BOTH)) {
    echo 
$row[0]." and ".$row['ID']." is the same<br>";
    echo 
$row[1]." and ".$row['NAME']." is the same<br>";
}
?>

Example #2 oci_fetch_array() with OCI_NUM example

<?php
$connection 
oci_connect("user""password");

$query "SELECT id, name, lob_field FROM fruits";

$statement oci_parse ($connection$query);
oci_execute ($statement);

while (
$row oci_fetch_array ($statementOCI_NUM)) {
    echo 
$row[0]."<br>";
    echo 
$row[1]."<br>";
    echo 
$row[2]->read(100)."<br>";  //this will output first 100 bytes from LOB
}
?>

Example #3 oci_fetch_array() with OCI_ASSOC example

<?php
$connection 
oci_connect("user""password");

$query "SELECT id, name, lob_field FROM fruits";

$statement oci_parse ($connection$query);
oci_execute ($statement);

while (
$row oci_fetch_array ($statementOCI_ASSOC)) {
    echo 
$row['ID']."<br>";
    echo 
$row['NAME']."<br>";
    echo 
$row['LOB_FIELD']."<br>";  //this will output "Object id #1"
}
?>

Example #4 oci_fetch_array() with OCI_RETURN_LOBS example

<?php
$connection 
oci_connect("user""password");

$query "SELECT id, name, lob_field FROM fruits";

$statement oci_parse ($connection$query);
oci_execute ($statement);

while (
$row oci_fetch_array ($statement, (OCI_NUM+OCI_RETURN_LOBS))) {
    echo 
$row[0]."<br>";
    echo 
$row[1]."<br>";
    echo 
$row['LOB_FIELD']."<br>";  //this will output LOB's content
}
?>



ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่