|
|
|
|
![]() ![]() |
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? |
|
|
|
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: [MODERATOR] Posts: 4,077 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() |
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 |
|
|
|
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 ';'
|
|
|
|
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!!!
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 7th October 2008 - 04:22 AM |