parse error to connect with database

Problems with the Windows version of XAMPP, questions, comments, and anything related.

parse error to connect with database

Postby douma » 11. October 2005 21:52

Well i get this error when i try to connect with the database : i am on my website local installed on my own computer

Parse error: parse error, unexpected T_LOGICAL_OR in C:\Program Files\xampp\htdocs\boerner2\system\connect.inc.php on line 7

Jan :)
douma
 
Posts: 7
Joined: 11. October 2005 12:07

Postby Wiedmann » 12. October 2005 12:42

There is an error in your script....
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby douma » 12. October 2005 13:03

Wiedmann wrote:There is an error in your script....


i try to connect to a database with this script :
Dear Mr. Douma,

I took a look at your panel and at the boerner Website: It seems to me
that you mixed username and database name: In the cPanel, the following
code is recommended to connect to the Database:

/ $dbh=mysql_connect ("localhost", "janzeros_jan", "<PASSWORD HERE>")=> what password? or
die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("janzeros_Boerner");


/but the error message reads:

mysql_connect(): Access denied for user: 'janzeros_Boerner@localhost'
(Using password: YEs

The users name is janzeros_jan, the DB-name is janzeros_Boerner. You try
to connect to the database as a user with the database name. To me, this
seems to be the root of all the problems. Use the recommended code above
and it should work.


jan
douma
 
Posts: 7
Joined: 11. October 2005 12:07

Postby Wiedmann » 12. October 2005 13:11

This is a mail and not a script :?:
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby douma » 12. October 2005 13:17

Wiedmann wrote:This is a mail and not a script :?:


<?php
//Dynamische Webseiten mit PHP - Echt einfach, Franzis Verlag
//Jochen Franke 2001-2004

//Diese Datei enthält die Anweisungen zum Aufnehemn einer Verbindung zur Datenbank
//Verbindung zur Datenbank aufnehmen
$db = mysql_connect("localhost","janzeros_Boerner","janzeros_jan") or die ("Verbindung fehlgeschlagen");
mysql_select_db("janzeros_Boerner",$db);
?>


The problem is i cannot connect to a database on my server, because i use a cpanel

Jan
douma
 
Posts: 7
Joined: 11. October 2005 12:07

Postby Wiedmann » 12. October 2005 13:31

With this code:
Code: Select all
<?php
//Dynamische Webseiten mit PHP - Echt einfach, Franzis Verlag
//Jochen Franke 2001-2004

//Diese Datei enthält die Anweisungen zum Aufnehemn einer Verbindung zur Datenbank
//Verbindung zur Datenbank aufnehmen
$db = mysql_connect("localhost","janzeros_Boerner","janzeros_jan") or die ("Verbindung fehlgeschlagen");
mysql_select_db("janzeros_Boerner",$db);
?>


you have this error:
Parse error: parse error, unexpected T_LOGICAL_OR in C:\Program Files\xampp\htdocs\boerner2\system\connect.inc.php on line 7

:?:

IMHO not possible. This code is correct and without syntax errors.

Maybe you have an error in the mainfile, because you include this code?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby douma » 12. October 2005 13:52

Maybe you have an error in the mainfile, because you include this code


Th eproblem is with the 3 parameters for this function

$db = mysql_connect("localhost","janzeros_Boerner","janzeros_jan")

i install the dynamic website local : 3 parameters
i install the dynamic website remote : 3 parameters

local i install a webserver on my computer for testing and remote i use a cpanel
jan
douma
 
Posts: 7
Joined: 11. October 2005 12:07


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 80 guests