From: scottsdev at gmail dot com
Operating system: Linux
PHP version: 5.2.1
PHP Bug Type: ODBC related
Bug description: ODBC+PHP+MSSQL generate error while executing multi query in
one transaction
Description:
------------
Hello,
I used DSN to established connection with MSSQL using following Cursor.
Code is >>>
$conn = odbc_pconnect($dsn,$username,$password, SQL_CUR_USE_ODBC) or
die("ERROR OCCUR WHILE CONNECTING TO THE SERVER");
I am getting following error when i tried to execute query like ...
$sql = "insert into <TBL_NAME> (col_1, col_2, col_3) values (val_1, val_2,
val_3); select SCOPE_IDENTITY() as LastInsertedID";
$results = odbc_exec($conn, $sql) or die("<br><pre>Query fail:
$query</pre>");
//////////////////////////////
if(!$results)
{
$this->error("<H2>No results!</H2>\n");
return false;
}else {
$data = array();
while ( $row = odbc_fetch_array($results))
{
$data = $row;
}
odbc_free_result($results);
$last_Id = $data['LastInsertedID'];
}
==================================================
So errors occurs
on this line: while ( $row = odbc_fetch_array($results))
Error is :
Warning: odbc_fetch_array() [function.odbc-fetch-array]: No tuples
available at this result index in D:\inetpub\wwwroot\php\xyz\lib\xxxx.php
on line 11111
So I really don't understand how to remove this error, and what to do so
that such two query can be run at once and return the result.
J. Scott
[scottsdev at gmail dot com]
--
Edit bug report at http://bugs.php.net/?id=40687&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40687&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40687&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40687&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40687&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40687&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40687&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40687&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40687&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40687&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40687&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40687&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40687&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40687&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40687&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40687&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40687&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40687&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40687&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40687&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40687&r=mysqlcfg