Hi Marco,

The usual method is something along the lines of:

--start--
$server = "localhost";
$username = "your username";
$password = "your password";
$database = "your database name";
$db_handler = mysql_connect($server, $username, $password) or die
(mysql_error());
mysql_select_db ($database);
---end---

The "die (mysql_error())" will echo the error message to the screen if the
connection failed, which at least will let you know what went wrong
(hopefully). You shouldn't have to enter the username and password anywhere
else but here (it's generally a good idea to have the above code in a
separate file, which you then include into any script that needs database
connectivity).

Armed with this information, you should be in a better position to sort it
out, but give us a shout if it's still not happy.

HTH
Jon


-----Original Message-----
From: Marco Bleeker [mailto:[EMAIL PROTECTED]]
Sent: 29 May 2001 16:25
To: [EMAIL PROTECTED]
Subject: Can't login to MySQL from PHP


Hello, I am a novice to Apache, MySQL and PHP. I have just installed these 
on my Win98SE machine, and want to do some off-line ('localhost') exercises 
before I go on the web. Apache and PHP work; I can run PHP scripts that do 
not access a database. But as soon as I try mysql_connect(), I get errors. 
I am sure it is something very basic I am missing. Perhaps it's a matter of 
username/password; I fooled around a bit with those, but to no effect (how 
are those verified? I suppose they have to be entered in 2 places?).

Does anyone have a hint? Or can someone guide me through a procedure to 
track the problem? Which additional info do you need?


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to