PHP Doku:: Returns the associative array that corresponds to the fetched row - function.cubrid-fetch-assoc.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-Startseite ≥ PHP-Handbuch ≥ Funktionsreferenz ≥ Datenbankerweiterungen ≥ Anbieterspezifische Datenbankerweiterungen ≥ Cubrid ≥ Cubrid Funktionen ≥ cubrid_fetch_assoc

Ein Service von Reinhard Neidl - Webprogrammierung.

Cubrid Funktionen

<<cubrid_fetch_array

cubrid_fetch_field>>

cubrid_fetch_assoc

(PECL CUBRID >= 8.3.0)

cubrid_fetch_assoc — Returns the associative array that corresponds to the fetched row

Beschreibung

array cubrid_fetch_assoc ( resource $req_identifier )

This function returns the associative array, that corresponds to the fetched row and, then, moves the internal data pointer ahead, or it returns FALSE when the end is reached.

Parameter-Liste

req_identifier

This is the request identifier.

Rückgabewerte

Associative array, when process is successful.

FALSE when the end is reached, or error.

Beispiele

Beispiel #1 cubrid_fetch_assoc() example

<?php
    $link 
= cubrid_connect("localhost", 30000, "demodb2", "dba", "");
    if (!
$link)
    {
        die(
'Could not connect.');
    }
    
$query = 'SELECT name, address, salary FROM employees';
    
$result = cubrid_execute($link, $query);
    if (
$result) 
    {
        echo 
"seek to row 0 and fetching fields: ";
        
cubrid_data_seek($result, 0);
        
$row = cubrid_fetch_assoc($result);
        echo 
$row["name"]."|". $row["address"]."|".$row["salary"]."<br>";

        echo 
"seek to row 2 and fetching fields: ";    
        
cubrid_data_seek($result, 2);
        
$row = cubrid_fetch_assoc($result);
        echo 
$row["name"]."|". $row["address"]."|".$row["salary"]."<br>";

        
cubrid_close_request($result); 
    }
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Result:
seek to row 0 and fetching fields: Peter|1st Avenue, New York|1000.0000000000000000
seek to row 2 and fetching fields: Peter Norton|81254, CA|19834.0000000000000000

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",...)