RE: [PHP-DB] odbc - strange behaviour on multiple odbc_exec...

From: Date: Mon, 14 Aug 2000 13:38:05 +0000
Subject: RE: [PHP-DB] odbc - strange behaviour on multiple odbc_exec...
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2039@lists.php.net to get a copy of this message
Gordon, I would try odbc_connect instead of odbc_pconnect, as a first guess, and make sure you are using the latest PHP version, as some odbc_exec problems were just fixed. Hope this helps! Best regards, Andrew ---------------------------------------------------- Andrew Hill Professional Services Consultant OpenLink Software http://www.openlinksw.com Universal Database Connectivity Technology Providers > -----Original Message----- > From: systems [mailto:systems@north.police.uk] > Sent: Monday, August 14, 2000 7:28 AM > To: php-db@lists.php.net > Subject: [PHP-DB] odbc - strange behaviour on multiple odbc_exec... > > > hi folks, I have another odbc problem - I hope someone can see what I'm > doing wrong, because I sure can't! > > The code makes a connection, and executes two queries. The first works > fine - no problem there. The second always gives an error. If I > strip out > the first completely, just leaving the second, it works ok! > > Here is the code:-- > $id = odbc_pconnect("DSN=crime_no; UID=ingres;PWD=xxx", "", > ""); > $sql = "select charge_type, search_descrip from CHARGE_CODES" . > " where charge_code = '$c' "; > $res = odbc_exec($id, $sql); > $r = odbc_fetch_row($res); > $ctype = odbc_result($r, "charge_type"); > $sdesc = odbc_result($r, "search_descrip"); > // everyrthing is cool to here - the above sql works > perfectly > // the next two lines are an attempt to get over > my problem > $e = odbc_commit( $id); > $e = odbc_free_result( $r ); > > // this following query gives me 'Warning: bad result > index 1 in > ... for each of > // the odbc_result calls. > $sql = "select seq_no, charge_text from CHARGE_STYLES " . > " where charge_code = '$c' order by seq_no"; > > $res = odbc_exec($id, $sql); > while ( $r = odbc_fetch_row($res)) { > $seq = odbc_result($r, "seq_no"); > $txt = odbc_result($r, "charge_text"); > echo "<P>$txt\n"; > }; > > One interesting thing is that, before I put in the > odbc_free_result, I used > to get an error saying there was no variable "seq_no", and > "charge_text" in > these last two odbc_result calls. BUT, if I changed "charge_text" to read > "charge_type" (ie, a column in the *first* odbc_exec), then that > is found!! > It's like as if the odbc result stuff is not clearing ; it's > still got stuff > from the previous query - hence my attempt at odbc_free_result... > > any thoughts please? > > many thanks again > > (Linux RH 6.1; Openlink ;, PHP 3; apache....) > > > Gordon Gallacher > Inverness, Scotland > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.db (#2039) next »