mysql connect error
| From: | John Byrne | Date: | Tue, 12 Aug 2003 07:06:14 +0000 |
| Subject: | mysql connect error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29838@lists.php.net to get a copy of this message | ||
Hi,
I've just started playing with Linux/MySQL/PHP - I come from a
Windows/ASP/PowerBuilder background.
I have created a database in MySQL and now are trying to connect to it via
PHP. I keep getting the same error, no matter what I specify in DSN. I
always get:
DB Error: no such database
The following is the PHP code I am using:
<?php
require_once 'DB.php';
$user = 'jbyrne';
$pass = '';
$host = 'localhost';
$db_name = 'sovereign';
$dsn = "mysql://$user:$pass@$host/$db_name";
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}
....
$db->disconnect();
?>
This is straight out of the PHP documentation.
Any ideas why I get the same error all the time.
I am using RedHat 8.0, PHP 4.2.2, MySQL 3.2.53, Apache 2.0
thanks