Posted by Jim Michaels on 02/12/06 05:10
"noone" <noone@nowhere.com> wrote in message
news:InqHf.27272$Jd.15753@newssvr25.news.prodigy.net...
> newbie wrote:
>> hi can anyone tell me why i am receiving error msg with this php script
>>
>>
>> <?php
>> require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
>>
>> $connection = mysql_connect($db_host,$db_user,$db_passwword) or
>> die
>> ("no connection");
>> echo "connection established";
>>
>> ?>
>>
>>
>> // this is the error message i am receiving.
>>
>> Parse error: syntax error, unexpected T_VARIABLE in
>> C:\webroot\config\db_config.php on line 2
>>
>> // I am using apache webserver 2.0 and php version 4.0 thankyou very
>> much
>> for your help.
>> // i am trying to access mysql database.
>>
>> anyhelp will be appreciated
>>
>> Marcus
>>
>
> To what does $_SERVER["DOCUMENT_ROOT"] translate? (should really be
> $_SERVER['DOCUMENT_ROOT']
doesn't matter which. PHP interprets both as a string just fine. nothing
special about it. Just depends on your style.
only thing that could make a difference is if that variable has a trailing /
in it. (echo it and find out) then you would want to remove the leading /
from "/config/db_config.php");
>
> before the above require statement add the following to see...
> echo $_SERVER['DOCUMENT_ROOT']."/config/db_config.php\n";
> echo $_SERVER["DOCUMENT_ROOT"]."/config/db_config.php\n";
> flush();
Navigation:
[Reply to this message]
|