Skip to Content.
Sympa Menu

freetds - 'Permission denied' not in $php_errormsg the 2nd time mssql_query is used in a single connection

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Pavel Hlousek" <hlousek AT excon.cz>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: 'Permission denied' not in $php_errormsg the 2nd time mssql_query is used in a single connection
  • Date: Tue, 18 Sep 2001 08:04:23 -0400


Hi,

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. Any help?




Archive powered by MHonArc 2.6.24.

Top of Page