RE: [PHP] Can't connect to MySQL
| From: | Brian Rue | Date: | Mon, 21 Aug 2000 22:59:45 +0000 |
| Subject: | RE: [PHP] Can't connect to MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12832@lists.php.net to get a copy of this message | ||
Thanks. It worked using "localhost".
-----Original Message-----
From: Jason Brooke [SMTP:jason@qgl.org]
Sent: Monday, August 21, 2000 3:42 PM
To: Brian Rue; php-general@lists.php.net
Subject: Re: [PHP] Can't connect to MySQL
> Hi,
>
> I'm not able to connect to MySQL from the following script:
> <?
> # connect to the db and see if the username and pwrd are valid
> $db =
> mysql_connect("www.instantpublicity4u.com","drue","password") or
> die("It didn't work.");
> mysql_select_db(ipdb,$db);
> ?>
> Is this the script? If so, please help me there. If not, what other causes are there for this
problem?
Does it print the "It didn't work" error?
If so, lack of permission to connect from outside the localhost, or with the username/password
combination you're supplying, is the first thing that springs to my mind.
If it doesn't print that error, it most likely means you've connected, and it's the
call to
mysql_select_db() that is the problem. You might want to enclose the name of the database in quotes,
and check that user 'drue' has adequate permission to use the 'ipdb' database.
Try putting a little more debug in there so you can get a better idea of where the error occured. At
least add 'or die("couldn't select ipdb database");' to the end of the
mysql_select_db(...) line.
jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net