Bug #15338: Can't select database with '-' in name.

From: Date: Sat, 02 Feb 2002 00:46:53 +0000
Subject: Bug #15338: Can't select database with '-' in name.
Groups: php.dev 
Request: Send a blank email to php-dev+get-78833@lists.php.net to get a copy of this message
From:             mikef@microtech.com
Operating system: windows NT IIS
PHP version:      4.1.1
PHP Bug Type:     MSSQL related
Bug description:  Can't select database with '-' in name.

I have a database on my MSSQL server with a '-' in the database name.  The
database works fine with all of my other applications including ASP. 
However, I cannot select the database with PHP.  Interestingly, a '-' in
the server name doesn't seem to be a problem.

$server="SQL-Server";
$dbName="My-DB";
$user="phpusr";
$passwd="phppass";

$hcon = mssql_connect($server, $user, $passwd);
if ($hcon == FALSE)
	die("Could not connect to SQL server '$server'");
$hdb = mssql_select_db($dbName, $hcon);

The resulting message is:

Warning: MS SQL message: Line 1: Incorrect syntax near '-'. (severity 15)
in C:\InetPub\PHP\dbtest.php on line 10

Warning: MS SQL: Unable to select database: My-DB in
C:\InetPub\PHP\dbtest.php on line 10
Could not select database 'My-DB'
-- 
Edit bug report at: http://bugs.php.net/?id=15338&edit=1
Fixed in CVS: http://bugs.php.net/fix.php?id=15338&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15338&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15338&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15338&r=oldversion
Not for support: http://bugs.php.net/fix.php?id=15338&r=support
Not wrong behavior: http://bugs.php.net/fix.php?id=15338&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15338&r=notenoughinfo



Thread (6 messages)

« previous php.dev (#78833) next »