|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41393 affected can't return
Submitted: 2007-05-15 04:13 UTC Modified: 2008-07-17 00:56 UTC
From: hack988 at gmail dot com Assigned: fmk (profile)
Status: Wont fix Package: MSSQL related
PHP Version: 4.4.7 OS: windows 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: hack988 at gmail dot com
New email:
PHP Version: OS:


 [2007-05-15 04:13 UTC] hack988 at gmail dot com
after executed sql query like that
IF NOT EXISTS (SELECT * FROM NumberGroup WHERE (GroupName = 'rrgrrg')) INSERT INTO NumberGroup(GroupName, AddTime) VALUES ('rrgrrg', 1);

an executed mssql_rows_affected alway return 0 either GroupName= 'rrgrrg' not in database

Reproduce code:
i have no idea to deal with this problem by myself

Expected result:
mssql_query("IF NOT EXISTS (SELECT * FROM NumberGroup WHERE (GroupName = 'rrgrrg')) INSERT INTO NumberGroup(GroupName, AddTime) VALUES ('rrgrrg', 1);");



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-03 16:52 UTC]
The MSSQL server returns two result sets. The first one for the status of the IF statement and the second for the insert.

The current implementation will not allow you to access the second result set (the first one must contain columns for the system to establish multiple result sets).


Use transactions and two querie. One to check if the row exists and one to insert the row.

 [2008-07-17 00:56 UTC]
We are sorry, but we can not support PHP 4 related problems anymore.
Momentum is gathering for PHP 6, and we think supporting PHP 4 will
lead to a waste of resources which we want to put into getting PHP 6

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 14:01:23 2020 UTC