Page 1 of 1

include path issue

Posted: Mon Jan 14, 2008 10:31 am
by PhpDog
I'm attempting to connect to a MS SQL Server with:



<?

\\ ------------ mssql connection test file --------------------

$db_variables = substr($PATH_TRANSLATED,0,strrpos($PATH_TRANSLATED,"\"))."\includes\config.php";
include("$db_variables");

$db_handle = mssql_connect($server,$user,$password) or die("Couldn't connect to SQL Server on $server");



?>

My file, config.php, sits in a directory 'includes' which is on the same directory level as directory 'wwwroot' in C:\inetpub on an XP Pro box, and contains the login variables. Currently, I have the error: "Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Inetpub\wwwroot\dbtest.php on line 5".

Where am I going wrong please? I've already tried forward-slashes instead, but this did not help me.

Re: include path issue

Posted: Mon Jan 14, 2008 10:34 am
by Mordred
Use double slashes.

Re: include path issue

Posted: Mon Jan 14, 2008 10:58 am
by Kieran Huggins
and by slashes, he means forward slashes:

Code: Select all

// this is a comment

Re: include path issue

Posted: Tue Jan 15, 2008 5:10 am
by PhpDog
Thanks guys.

After much research, I also discovered that MS SQL Server 2005 ships with an old dll (ntwdb.dll). I updated that and can now connect and begin work at long last.