php.de

Zurück   php.de > Webentwicklung > Datenbanken

Datenbanken SQL und Co

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 05.02.2009, 12:56  
Neuer Benutzer
 
Registriert seit: 05.02.2009
Beiträge: 8
soezkan befindet sich auf einem aufstrebenden Ast
Standard Warning: odbc_free_result(): 12 is not a valid ODBC result resource

Hallo zusammen,

ich bin neu im Forum und grüße alle!

Wenn ich ein odbc_free_result() mache, dann bekomme ich das Warning
Warning: odbc_free_result(): 12 is not a valid ODBC result resource

Wie kann ich vorher prüfen, ob eine id vorhanden und gültig ist oder nicht?
Oder soll ich einfach ein @odbc_result_resource machen und das Warning schlicht ignorieren?

Keine Ahnung wo die Resource Id #12 überhaupt herkommt in meinem Skript.
Übrigens hatte ich das Gleiche Problem als ich mssql_free_result benutzt habe.

1000 Dank für Tipps, schonmal.

Viele Grüße
Soezkan
soezkan ist offline   Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 05.02.2009, 12:58  
da schreibt der ElePHPant
 
Benutzerbild von Flor1an
 
Registriert seit: 18.06.2008
Beiträge: 8.903
PHP-Kenntnisse:
Fortgeschritten
Flor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer Anblick
Standard

Auf was wendest du diese Funktion an? Diese ResourceID Fehler kommen meistens wenn du kein ResultSet hast bzw. keinen Query.

Ein Codeausschnitt wäre net schlecht.
Flor1an ist offline   Mit Zitat antworten
Alt 05.02.2009, 13:58  
Neuer Benutzer
 
Registriert seit: 05.02.2009
Beiträge: 8
soezkan befindet sich auf einem aufstrebenden Ast
Standard

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->Debugprintf("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
soezkan ist offline   Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Erledigt] PHP -&gt; Ordner anlegen der sich auch beschreiben lässt?! Nightuser PHP Tipps 2008 13 30.06.2008 23:51
Warning: fread(): supplied argument is not a valid stream resource... pixelprinzessin PHP Tipps 2008 20 23.04.2008 15:44
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Zabimaru PHP Tipps 2008 7 02.04.2008 13:25
Warning: fwrite() ??? Razoback PHP Tipps 2006 1 25.07.2006 21:37
Warning: fwrite(): supplied argument is not a valid stream Venom PHP Tipps 2007 27 15.12.2005 18:14
kleines problem mit fwrite Tic Rederon PHP Tipps 2005-2 6 23.08.2005 08:24
Suche Tipps für Persormance-Steigerung (Geld für Nützliches) Beitragsarchiv 18 16.08.2005 10:57
Suche Programmierer, Designer, Schreiber... blinkster.de Beitragsarchiv 76 14.08.2005 18:31
update auf php 5.0.4 robo47 Server, Hosting und Workstations 6 10.04.2005 19:00
ShowIt_V1.8.14 PHP Tipps 2005 1 23.03.2005 19:13
frage zum arbeiten mit dateien PHP Tipps 2005 21 01.03.2005 13:22
[Erledigt] MySQl+PHP+select Datenbanken 2 12.02.2005 16:38
bannergenerator PHP Tipps 2005 7 03.02.2005 10:04
Counter zeigt nach ca. 2-3 Stunden fehler an PHP Tipps 2004 2 26.08.2004 20:08
Häää ?supplied argument is not a valid MySQL result resource Sachse PHP Tipps 2004 4 17.07.2004 18:03

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
is not a valid odbc result resource, php odbc_free_result, supplied argument is not a valid odbc result resource, odbc result id, odbc_fetch_array(): supplied argument is not a valid odbc result resource, 5 is not a valid odbc result resource, \resource id\=12 \'odbc result\', is not a valid odbc result resource in, is not a valid odbc result resource php, odbc result resource warning, odbc_free_result(): 22 is not a valid odbc result resource, odbc_result(): 22 is not a valid odbc result resource in, warning odbc_free_result, ist not a valid odbc result, warning: odbc_fetch_array(): supplied argument is not a valid odbc result resourc, argument is not a valid odbc result resource, 16 is not a valid odbc result resource, valid odbc result resource in, odbc_free_result, odbc result id 6

Alle Zeitangaben in WEZ +2. Es ist jetzt 04:30 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum