php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13368 2nd call to @mssql_query does not fill $php_errormsg s'd be'permission denied'
Submitted: 2001-09-18 10:30 UTC Modified: 2005-05-30 11:37 UTC
From: hlousek at excon dot cz Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.0.6 OS: SuSe Linux 7.1
Private report: No CVE-ID: None
 [2001-09-18 10:30 UTC] hlousek at excon dot cz
I'm using MSSQL 7.0 on WinNT4.0, FreeTDS 0.51 with tdsver=4.2, client is
SuSe Linux 7.1, Apache 1.3.19, PHP 4.0.6.

I've run into troubles while checking SELECT permissions for several
tables within a single db connection. In a typical case, I think, this
should work fine:

##################################################
$php_errormsg = '';
@mssql_query("SELECT * FROM $table");
if (!empty($php_errormsg)) {
echo "It seems you cannot access table $table";
}
##################################################

But this code works only the first time within a single connection to
MSSQL server. The 2nd call to such a code does nothing with the contents
of $php_errormsg, even when there should be message 'Permission denied'.
(Sometimes the next call to mssql_query without '@' fires the exception.)

I've also tried a piece of code like this, but the result was the same:

##################################################
$php_errormsg = '';
$result = mssql_query("SELECT * FROM $table");
if (! $result) {
echo "It seems you cannot access table $table";
}
##################################################

It seems to me, that there is a bug somewhere. The only way to handle this situation seems to be reconnecting to the MSSQL server. Any help?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-03 22:07 UTC] zak@php.net
This may have just been corrected in the development 
version of PHP.

Could you please download and build the php4-latest 
snapshot from http://snaps.php.net?

Alternately, the change should be in the next release of 
PHP.

 [2002-01-25 11:48 UTC] sander@php.net
No feedback.
 [2005-05-30 10:38 UTC] freddyz77 at tin dot it
FreeTDS 0.51 is very old, error handling has been entirely rewritten.
You can close the bug report.

freddy77
(FreeTDS developer)
 [2005-05-30 11:37 UTC] tony2001@php.net
No PHP bug -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC