oci_result
(PHP 5, PHP 7, PHP 8, PECL OCI8 >= 1.1.0)
oci_result — 返回所取得行中字段的值
参数
statement-
column-
可以使用列号(从 1 开始)或列名。列名的大小写必须是 Oracle 元数据描述该列的大小写,对于创建的不区分大小写的列来说是大写。
返回值
以字符串形式返回除抽象类型(ROWID、LOB 和 FILE)之外的所有内容。在出错时返回 false。
示例
示例 #1 oci_fetch() 和 oci_result()
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$sql = 'SELECT location_id, city FROM locations WHERE location_id < 1200';
$stid = oci_parse($conn, $sql);
oci_execute($stid);
while (oci_fetch($stid)) {
echo oci_result($stid, 'LOCATION_ID') . " is ";
echo oci_result($stid, 'CITY') . "<br>\n";
}
// Displays:
// 1000 is Roma
// 1100 is Venice
oci_free_statement($stid);
oci_close($conn);
?>参见
- oci_fetch_array() - Returns the next row from a query as an associative or numeric array
- oci_fetch_assoc() - Returns the next row from a query as an associative array
- oci_fetch_object() - Returns the next row from a query as an object
- oci_fetch_row() - Returns the next row from a query as a numeric array
- oci_fetch_all() - 从查询中读取多行到二维数组中