Dynamic Web Pages: deutschsprachiger PHP Knotenpunkt seit 1999

Dynamic Web Pages : deutschsprachiges PHP-Handbuch : odbc-next-result _

 
   
  _  
 
<odbc_longreadlen odbc_num_fields>
Letzte Aktualisierung: Thu, 28 Aug 2014
 

odbc_next_result

(PHP 4 >= 4.0.5, PHP 5)

odbc_next_result -- Checks if multiple results are available

Description

bool odbc_next_result ( resource result_id )

odbc_next_result() returns TRUE if there are more result sets available as well as allowing access to the next result set via odbc_fetch_array(), odbc_fetch_row(), odbc_result(), etc.

This function returns FALSE on error.

The argument is a valid result identifier returned by odbc_exec().

Beispiel 1. odbc_next_result()

<?php
$r_Connection
= odbc_connect($dsn, $username, $password);

$s_SQL = <<<END_SQL
SELECT 'A'
SELECT 'B'
SELECT 'C'
END_SQL;

$r_Results = odbc_exec($r_Connection, $s_SQL);

$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo
"Dump first result set";
var_dump($a_Row1, $a_Row2);

echo
"Get second results set ";
var_dump(odbc_next_result($r_Results));

$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo
"Dump second result set ";
var_dump($a_Row1, $a_Row2);

echo
"Get third results set ";
var_dump(odbc_next_result($r_Results));

$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo
"Dump third result set ";
var_dump($a_Row1, $a_Row2);

echo
"Try for a fourth result set ";
var_dump(odbc_next_result($r_Results));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Dump first result set array(1) {
  ["A"]=>
  string(1) "A"
}
bool(false)
Get second results set bool(true)
Dump second result set array(1) {
  ["B"]=>
  string(1) "B"
}
bool(false)
Get third results set bool(true)
Dump third result set array(1) {
  ["C"]=>
  string(1) "C"
}
bool(false)
Try for a fourth result set bool(false)



<odbc_longreadlen odbc_num_fields>
Letzte Aktualisierung: Thu, 28 Aug 2014
 


powered by Hetzner
top Alle Rechte vorbehalten. © Dynamic Web Pages 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 top

Werbung an/aus Werbung aus Werbung an