From:             marek at erneker dot cz
Operating system: Debian 2.6.9
PHP version:      4.3.10
PHP Bug Type:     MSSQL related
Bug description:  mssql_query returns

Description:
------------
Returns of mssql_query where I run SQL: INSERT, DELETE, USE or UPDATE
command is allways FALSE. It is not depend on result SQL query. 

I tried use FreeTDS 0.62.1, 0.62.3, 0.62.4. 

Reproduce code:
---------------
$cLink = mssql_pconnect('mssql.server.com', 'user', 'password');

$qSelDb = mssql_query('use database');
echo "USE DB return: ";var_dump($qSelDb);echo "\n";

$qDelete = mssql_query('DELETE FROM a', $cLink);
echo "DELETE FROM return:";var_dump($qDelete);echo "\n";

$qSelAll = mssql_query('SELECT * FROM a', $cLink);
echo "SELECT (0 rows) return: ";var_dump($qSelAll);echo "\n";

$iInsertId = rand(1, 1000); $qInsert = mssql_query('insert into a (id)
values ('.$iInsertId.');', $cLink);
echo "INSERT return: ";var_dump($qInsert);echo "\n";

if (!$qInsert) echo "MSSQL ERROR:".mssql_get_last_message()."\n";

$qInsert = mssql_query('SELECT * FROM a');
while ($aData = mssql_fetch_assoc($qInsert)) echo "VALUE IN TABLE:
".$aData['id']."\n";

echo "inserted value: ".$iInsertId;

mssql_close($cLink);

Expected result:
----------------
/*if 'INSERT STATEMENT IS OK':*/
USE DB return: bool(true)

DELETE FROM return:bool(true)

SELECT (0 rows) return: resource(3) of type (mssql result)

INSERT return: bool(true)
VALUE IN TABLE: XYZ
inserted value: XYZ

/*if 'INSERT STATEMENT IS FALSE':*/
USE DB return: bool(true)

DELETE FROM return:bool(true)

SELECT (0 rows) return: resource(3) of type (mssql result)

INSERT return: bool(false)
MSSQL ERROR: <Some MSSQL Error>
inserted value: XYZ


Actual result:
--------------
USE DB return: bool(false)

DELETE FROM return:bool(false)

SELECT (0 rows) return: resource(3) of type (mssql result)

INSERT return: bool(false)

MSSQL ERROR:Changed database context to 'database'.
VALUE IN TABLE: 480
inserted value: 480


-- 
Edit bug report at http://bugs.php.net/?id=31152&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31152&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31152&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31152&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31152&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31152&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31152&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31152&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31152&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31152&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31152&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31152&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31152&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31152&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31152&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31152&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31152&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31152&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31152&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31152&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31152&r=mysqlcfg

Reply via email to