include path issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PhpDog
Forum Commoner
Posts: 58
Joined: Mon Jan 14, 2008 10:23 am

include path issue

Post 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.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: include path issue

Post by Mordred »

Use double slashes.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: include path issue

Post by Kieran Huggins »

and by slashes, he means forward slashes:

Code: Select all

// this is a comment
PhpDog
Forum Commoner
Posts: 58
Joined: Mon Jan 14, 2008 10:23 am

Re: include path issue

Post 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.
Post Reply