Danke schonmal für die Antwort.
Einen Codeausschnitt, hm, schwierig, denn die ganze Sache ist in einer Klasse untergebracht:
PHP-Code:
# discard the query result
function free() {
odbc_free_result($this->Query_ID);
$this->Query_ID = 0;
}
Also die Methode free() wird innerhalb dieser Methode aufgerufen, ist aber ziemlich komplex:
PHP-Code:
# perform a query
function query($Query_String) {
$this->query_string = $Query_String;
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;
if (!$this->connect()) {
return 0; # we already complained in connect() about that.
};
# New query, discard previous result.
if ($this->Query_ID) {
$this->free(); }
if ($this->Debug) printf("Debug: query = %s<br>\n", $Query_String);
$this->Query_ID = odbc_exec($this->Link_ID, $Query_String);
$this->Row = 0;
#$this->Errno = odbc_errno();
$this->Error = odbc_errormsg($this->Link_ID);
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
# Will return nada if it fails. That's fine.
return $this->Query_ID;
}
... und hier ...
PHP-Code:
# walk result set
function next_record() {
if (!$this->Query_ID) {
$this->halt("next_record called with no query pending.");
return 0;
}
$this->Record = odbc_fetch_array($this->Query_ID);
$this->Row += 1;
$this->Error = odbc_errormsg($this->Link_ID);
$stat = is_array($this->Record);
if (!$stat && $this->Auto_Free) {
$this->free();
}
return $stat;
}
Ich mache dann sowas wie:
$db ist das Datenbank-Object ...
$db->query("SELECT * ...");
while($db->next_record()) echo $db->f(... gib mir den Wert ...);
Bin mir nicht sicher, ob das hilft, was ich hier poste, aber ich denke mal
das irgendwo ein Result verloren geht. Fragt sich nur wie man das
beheben kann.
Danke!
Viele Grüße
Soezkan