PHP Doku:: Fetch a result row as an associative array, a numeric array, or both - function.cubrid-fetch-array.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenCubridCubrid Funktionencubrid_fetch_array

Ein Service von Reinhard Neidl - Webprogrammierung.

Cubrid Funktionen

<<cubrid_execute

cubrid_fetch_assoc>>

cubrid_fetch_array

(PECL CUBRID >=8.3.0)

cubrid_fetch_arrayFetch a result row as an associative array, a numeric array, or both

Beschreibung

array cubrid_fetch_array ( resource $req_identifier [, int $type = CUBRID_BOTH ] )

The cubrid_fetch_array() function is used to get a single row from the query result and returns an array. The cursor automatically moves to the next row after getting the result.

Parameter-Liste

req_identifier

Request identifier.

type

Array type of the fetched result CUBRID_NUM, CUBRID_ASSOC, CUBRID_BOTH.

Rückgabewerte

Returns an array of strings that corresponds to the fetched row, when process is successful.

FALSE, when process is unsuccessful.

The type of returned array depends on how type is defined. By using CUBRID_BOTH (default), you'll get an array with both associative and number indices, and you can decide which data type to use by setting the type argument. The type variable can be set to one of the following values:

  • CUBRID_NUM : Numerical array (0-based)
  • CUBRID_ASSOC : Associative array
  • CUBRID_BOTH : Numerical & Associative array (default)

Beispiele

Beispiel #1 cubrid_fetch_array() example

<?php
$req 
cubrid_execute($con"select * from members"CUBRID_INCLUDE_OID CUBRID_ASYNC);
if (
$req) {
   while (list(
$id$name) = cubrid_fetch_array($req)){
      echo 
$id;
      echo 
$name;
   }
   
cubrid_close_request($req);
}

$req cubrid_execute($con"select * from teams");
if (
$req) {
   while(
$row cubrid_fetch_array($reqCUBRID_ASSOC)) {
      echo 
$row["id"];
      echo 
$row["name"];
   }
}
?>

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)