Click to See Complete Forum and Search --> : small question


Annaccond
05-15-2007, 11:40 PM
Sorry if my question sounds silly but I have problem with something very easy. This is how looks beginning of index page of some script:

$dbhost = "sql.mysite.com";
$dbuser = "root";
$dbpass = "root";
$dbname = "abc";

$domain = $_SERVER['SERVER_NAME']=='localhost' ? '' : ".$_SERVER[SERVER_NAME]"; //.yoursite.com

I don't know how and where to write server name and host name. It seems to be logic for me write in in SERVER_NAME but I wrote it in many different forms like:

- mysite.com
- .mysite.com
- ./
- www.mysite.com
- http://www.mysite.com

and it doesn't work. I changed also localhost to sql.mysite.com but still nothing. I'm getting Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /test/config.php on line 9 (it's that line with server name).

In which form I should write it?

chestertb
05-16-2007, 05:21 PM
I think what you're trying to achieve is this...
<?php
$dbhost = "sql.mysite.com";
$dbuser = "root";
$dbpass = "root";
$dbname = "abc";

$domain = $_SERVER['SERVER_NAME']=='localhost' ? '' : ".".$_SERVER['SERVER_NAME']; //.yoursite.com
This will give you
.server.tld

You simply has a syntax error near :."

Annaccond
05-17-2007, 02:01 PM
After many problems I was able to install script but it doesn't work. Seems that whole script is broken.