|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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\wwwroot\sources\database.php on line 23 Notice: Use of undefined constant root - assumed 'root' in c:\inetpub\wwwroot\sources\database.php on line 23 Unknown database 'insert your database details here' i be happy if some one help me fix this problem.Thanks |
|
#2
|
||||
|
||||
|
shouldn't this:
Code:
$this->connection = mysql_connect(localhost,root) or die(mysql_error()); be this: Code:
$this->connection = mysql_connect("localhost","root") or die(mysql_error());
with the quotes around localhost and root
__________________
Come JOIN the party!!! Quote of the Month: Retirement: Because you've given so much of yourself to the company that you don't have anything left we can use. Questions to Ponder: What do you do when you see an endangered animal eating an endangered plant? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > problem connecting to mysql server via php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|