Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem connecting to mysql server via php

Status
Not open for further replies.

JASONE25

Technical User
Jun 23, 2005
54
NL
Hi every body. I got an php scrip that supposed to connect to mysql sever. The connection string was like this one

Code:
$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS)

since i am runing mysql server on local server i did not put any pass for it and i tried to connect like this :

Code:
    $this->connection = mysql_connect(localhost,root) or die(mysql_error());

But unfortuently when i run it. I get the following error:

Code:
Notice: Use of undefined constant localhost - assumed 'localhost' in c:\inetpub\[URL unfurl="true"]wwwroot\sources\database.php[/URL] on line 23

Notice: Use of undefined constant root - assumed 'root' in c:\inetpub\[URL unfurl="true"]wwwroot\sources\database.php[/URL] on line 23
Unknown database 'insert your database details here'


i be happy if some one help me fix this problem.Thanks
 
Should they not be strings - 'localhost' and 'root' or $localhost and $root? You'll probably want a password too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top