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.
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
Hi, when running a PHP script I keep getting the error: QUOTE Notice: Undefined variable: bret
in c:\program files\easyphp1-8\home\poll.php on line 294 Notice: Undefined
variable: bret in c:\program files\easyphp1-8\home\poll.php on line 294 (And,
yes, I get it twice). The code related to the variable is as follows: CODE function
LogString($string,$type) { $t_log = "\n";
$t_log .=
$this->globaldata->server_vars['REMOTE_ADDR']."....
Ok i can't believe I need help in php but I can't figure this out... If i have an array,
lets say called test, how do i get a certain value from that array when referencing it dynamically
by either a string or another variable? Example: CODE $test=array(1,2,5);
$name="test"; //Doesn't work: echo $$name[0]; /Doesn't
work: echo ${$name}[0]; ....
Hello, I am trying to make an employee application. I was just wondering if anyone knows how to spot
a php code error, when the code directly around the line with the error looks the same. below is
some of my process.php code. I beleive the error is on line 41. QUOTE PHP parse error: PHP
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in
/home/wwwange/public_html/FORMS/forms/process.php on line 41 Process.php code: CODE
<?php include("global.inc.php"); $errors=0; $error="The foll....
Say I have a variable such as $nav_item and it had to contents Home . IE: CODE
$nav_item = 'Home'; How would I make so that $nav_item was an array and
had the following contents? CODE $nav_item = array ('h', 'o',
'm', 'e'); With the case changing (ie H would become h and U
would become u ) EDIT: Okay found out that I could change the case with
array_change_key_case ($nav_item, CASE_LOWER); ....
I have a single page template which has a Form on it. Logic is to check for a valid Querystring and
place the variables accepted from a form back into the form and re-display this form with error or
acceptance messages. I'm sure everyone here has done this a million times. The Form accepts
data from a user for First name, Last name, email address, and message-body named
'note_wide' then re-displays the values into the Form, but for some reason, I can't get
the value to display into a Textarea. Sample of the php code is as follows: first the good one:....
I am getting this message when testing a script I made: QUOTE Parse error: parse error,
unexpected $ in /home/globa38/public_html/forum/mods/phpbb_fetch_all/news/forumnews.php on line
159 On line 159, which is the last line in that file, I can only see this: CODE ?>
What's the problem, and how can I fix it? /unsure.gif' border='0'
style='vertical-align:middle' alt='unsure.gif' /> ....
Hi. I've just created a php script. The main object of the script is to delete some old files
and replace it with a new file with some new content, effectively moving the contents from one file
to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) {
$a_B++; } $new_page_contents = " " . $_POST . " " . $_POST . "
include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen(&....
i have this code CODE <?php if($_POST['user']=="" or
$_POST['pass']=="" or $_POST['host']==""
or $_POST['root']=="" or
!isset($_POST['run'])){ print('<form method=post
name=form>'); print('FTP username <input type=\'text\'
name=user value=""><br>'); print('FTP password <input
type=\'password\....
I have a input box in a form called "button" and when the user clicks Submit! I want php to
determine whether or not this is a url or just text. All urls have "http://" in them so I have
decided I need a script which can determine whether or not "http://" is in a variable or a string.
The problem with using strings is that I've never needed to use them before (and thus have no
knowledge about them). When I was using asp, I knew there was a function called instr() but I
can't find php's equivalent. Does anybody know? Thanks in advance!....
I am trying to create a file which send mail after a user has filled in the appropiate fields in a
form. It checks to see whether the required fields are full, writes some mail headers and sends it.
When I check to see if the code works, I get this error: QUOTE(affliates.cmat) Parse error:
parse error, unexpected $ in /home/cmatcme/public_html/affliates.cmat on line 203 The
funny thing is that regardelss of how long I make the file, the file always appear on the final
line, whether I leave it blank or just put ?> . I understand that these errors ca....
You see I have a most intresting problem, basicaly I get the following error: QUOTE Parse error:
parse error, unexpected $ in /path/result.php on line 99 Now normaly when I have problems
I go to line 99 and add a ; or a " or something the problem is in my file line 99 is , CODE
<tr bgcolor="#FFFFFF"> <td width="25" height="5"
background="images/q3.png"> </td> <td height="25"
align="right" valign="top" background="images/bot.png"><span cla....
Okay I'm very new to PHP still, although you may recognize me from the threa before, just go
finished finals so now back to PHP! On one page I accept an input which will tell the next page
how many form lines to generate, that part I have worked out, or so I think. Because the number of
forum fields could vary I need to have a number of forum variables, so I used this code: CODE
echo "<td><input name=\"wname" . $appendval . "\"
type=\"text\" id=\"wname" . $appendval . "....
ok this is my config script that runs my site: CODE <? # Set up info for left column on the
top page: # It should begin with html tag <td> and finish with tag </td>
$top_leftcol=" <td width='195' bgcolor='#eeeeee'
valign='top'> <table width='100%' bgcolor='#777799' border=0
cellspacing='0' cellpadding='0'> <tr><td> <font
FACE='ARIAL, HELVETICA' color='#ffffff' size='-1'>
<b>MMORPG Trade Center<....
I've created a form, nothing special, that uses a php script as a form action to input data into
mysql. Nothing special at all about this scenario. One thing I'd like to do is have the php
script redirect the user back to the html page that has the form the user just completed. I
don't want to have to hard code the url into the header function because I use this php script
with a bunch of other pages. Does PHP store the value of this page into some variable that the php
script can use? Thanks. kvarnerexpress....
I would be greatful if anyone could help me out, I have been stuck on this for a while. The problem
is that I have a drop down menu which I get the contents of from a database. Then when I press the
get details button I want to use the value selected in my drop down menu and pass it into an SQL
statement to recieve all te relevent info. Everything works if I specify a known variable, but the
problem seems to be passing a variable in which is part of the array. Below is the code for the drop
down menu and the Sql statement i'm trying to execute. drop down menu: ....
Ok, so I'm using the include() function on my website. Problem is I'm trying to include a
search engine form into the layout which is stored in a variable, except the form has an if
statement in it and I can't seem to get it working. Here's the code I'm trying to
include... CODE Search: > Just wondering if it is possible for me to put this
form with the if statement into a variable, or if there's another way that I could go about
doing this. Thanks.....
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.