Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

getting started

Codes here !

Moderators: macek, egami, gesf

getting started

Postby phpnewbie » Mon Mar 10, 2003 8:25 pm

I am trying to connect to a database on my server. I have:

Code: Select all
<?

$connection = mysql_connect("kennedywebdev.com","user","****")

$connection = mysql_connect("kennedywebdev.com","user","****") or die ("Couldn't connect.");

if ($connection) {
        $msg = "success!";
}

?>

<HTML>
<HEAD>
<TITLE>MySQL Connection</TITLE>
</HEAD>
<BODY>

<? echo "$msg"; ?>

</BODY>
</HTML>


I get the following parse error when viewing the file:

Parse error: parse error, unexpected T_VARIABLE in /home/kennedyw/public_html/db_connect.php on line 5

What is wrong?

NOTE: you can view the file error: http://kennedywebdev.com/db_connect.php

Thanks

//Edited by Pejone

Never post here your login and password and one more i fix in script that arror that Redcircle talked about.
phpnewbie
New php-forum User
New php-forum User
 
Posts: 7
Joined: Mon Mar 10, 2003 8:10 pm
Location: Washington State

Postby Redcircle » Mon Mar 10, 2003 9:44 pm

Before you post please make sure there are no typos and all your ; are there. You are missing one. That is probably the problem also you have a < where there should be a (
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby Unknown » Tue Mar 11, 2003 3:47 am

Delete this line you are setting the variable $connection twice.

$connection = mysql_connect("kennedywebdev.com","user","****")

And would read this first http://phpbuilder.com/columns/tim20010101.php3
Unknown
New php-forum User
New php-forum User
 
Posts: 9
Joined: Mon Jan 13, 2003 10:33 am

Postby phpnewbie » Tue Mar 11, 2003 8:39 am

Thanks for your help. But now I get this error:

Warning: Access denied for user: 'kennedyw_sandman@apollo.servnow.com' (Using password: YES) in /home/kennedyw/public_html/db_connect.php on line 3

Warning: MySQL Connection Failed: Access denied for user: 'kennedyw_sandman@apollo.servnow.com' (Using password: YES) in /home/kennedyw/public_html/db_connect.php on line 3
Couldn't connect.
phpnewbie
New php-forum User
New php-forum User
 
Posts: 7
Joined: Mon Mar 10, 2003 8:10 pm
Location: Washington State

Postby Redcircle » Tue Mar 11, 2003 10:58 am

that means that the username or password are incorrect
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.