php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31152 mssql_query returns
Submitted: 2004-12-17 14:28 UTC Modified: 2004-12-17 14:46 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: marek at erneker dot cz Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.3.10 OS: Debian 2.6.9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marek at erneker dot cz
New email:
PHP Version: OS:

 

 [2004-12-17 14:28 UTC] marek at erneker dot cz
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-17 14:46 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

There was already report about this and the bug is already fixed..please try search the bug database BEFORE you submit any report!!!!!

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 03:01:28 2024 UTC