Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Unexpected T_variable..., Help!
alex1985
post Apr 20 2008, 03:53 PM
Post #1


Super Member
*********

Group: [HOSTED]
Posts: 411
Joined: 9-February 08
Member No.: 57,615



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:

CODE

<?
//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 DB
function 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 DB
function db_logout() {
@mysql_close($link);
}
?>


But, this is the message the browser gives me when I am trying to initiate that constructed file.

QUOTE
"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. wink.gif
Go to the top of the page
 
+Quote Post
jlhaslip
post Apr 20 2008, 04:00 PM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,077
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol



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 Trap17 account...

$confg['db_dbase']="alex1985_books" //Your database name and Cpanel name prefix

And there seem to be ";" missing... as statement terminators... on all the assignment statements
Go to the top of the page
 
+Quote Post
roooss
post Apr 20 2008, 06:01 PM
Post #3


Newbie [Level 2]
**

Group: [HOSTED]
Posts: 25
Joined: 19-April 08
Member No.: 61,043



yeah its saying line 4 because you never terminated the command on line 3 so it thinks its just one whole command. start using ';' biggrin.gif
Go to the top of the page
 
+Quote Post
alex1985
post Apr 20 2008, 08:25 PM
Post #4


Super Member
*********

Group: [HOSTED]
Posts: 411
Joined: 9-February 08
Member No.: 57,615



Thanks. I should pay more attention when do coding. Such simple mistakes!!!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Stored Or Global Variable?(1)
  2. Php Parse Error(2)
  3. Calling A False Variable...(6)
  4. Unexpected $(9)
  5. Unexpected "$" Sign On Last Line Of File(3)
  6. Determining Whether A Phrase Is In A Variable(2)
  7. Parse Error(1)
  8. Parse: Error Unexpected T_lnumber(4)
  9. Unexpected $ Where There Aren't Any(7)
  10. <textarea> Tag Is Not Accepting Php Variable(2)
  11. Converting Characters In A Variable To Individual Values In An Array(2)
  12. Php Form Help!(3)
  13. Getting An Array Value Of A Dynamic Variable(9)
  14. Script Help Required: Undefined Variable(3)
  15. Unexpected T_string In User.php [resolved](5)


 



- Lo-Fi Version Time is now: 7th October 2008 - 04:22 AM