getting started

Codes here !

Moderators: macek, egami, gesf

phpnewbie
New php-forum User
New php-forum User
Posts: 7
Joined: Mon Mar 10, 2003 8:10 pm
Location: Washington State

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.

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

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 (

Unknown
New php-forum User
New php-forum User
Posts: 9
Joined: Mon Jan 13, 2003 10:33 am

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

phpnewbie
New php-forum User
New php-forum User
Posts: 7
Joined: Mon Mar 10, 2003 8:10 pm
Location: Washington State

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.

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

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

that means that the username or password are incorrect


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest