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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
26 - 22 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 11:01:27 2024 UTC