Jump to content
xisto Community
alex1985

Unexpected T_variable... Help

Recommended Posts

I did construct the database connection file which is called "config.php". But, I got some mistake that has to be solved to continue with working.

This is the code itself:

$confg['db_paswd']="" //Your database user's password
$confg['db_host']="localhost" //Your host
$confg['db_dbase']="books" //Your database name
//Create the function to log into the DB
function db_login() {
global $confg;
$link = @mysql_connect($confg['db_host'], $confg['db_uname'], $confg['db_paswd']) or die("Error connecting linenums:0'><?//Set the database values$confg['db_uname']="alex1985_admin" //Your database username$confg['db_paswd']="" //Your database user's password$confg['db_host']="localhost" //Your host$confg['db_dbase']="books" //Your database name//Create the function to log into the DBfunction db_login() {global $confg;$link = @mysql_connect($confg['db_host'], $confg['db_uname'], $confg['db_paswd']) or die("Error connecting: " . mysql_error());@mysql_select_db($confg['db_dbase'], $link);}//Create the function for logging out from the DBfunction db_logout() {@mysql_close($link);}?>
But, this is the message the browser gives me when I am trying to initiate that constructed file.

"Parse error: syntax error, unexpected T_VARIABLE in /home/alex1985/public_html/mulhim/library_project/test_dir/test1/config.php on line 4"

If I am not mistaken there is the mistake with the entry: "$confg['db_paswd']="userpw", for instance.

I'm sure that I entered it correctly.

What should I do?

Notice from truefusion:
Removed password for your security. ^_^

Share this post


Link to post
Share on other sites

Couple of things, first of all, while you are developing the scripts, remove the "at" signs from the front of the mysql commands. Having the "at" signs in front reduces the Error Messages, which might be useful to you while debugging. They can be put back later, when the site is "live".Secondly, I believe the DB-name requires the Cpanel user name as a Prefix. Assuming you are using your Xisto account...$confg['db_dbase']="alex1985_books" //Your database name and Cpanel name prefixAnd there seem to be ";" missing... as statement terminators... on all the assignment statements

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.