Trouble connecting to MySQL database using PHP
<p>I have a 3 file:</p>

<pre><code>class.database.php
config.php
test.php
</code></pre>

<p>In class.database.php i using:</p>

<pre><code>&lt;?php
class Database {

    private $db_connect;
    function __construct($config) {
        $this-&gt;connect($config);
    }

    function connect($config) {
        $this-&gt;db_connect = @mysql_connect($config['hostname'], $config['dbuser'], $config['dbpass']) or die("Can't connect to mysql server");
        @mysql_select_db($config['dbname'], $this-&gt;db_connect) or die("Can't select database mysql server");
        $this-&gt;query('set names utf8'); 
    }

    function disconnect() {
        mysql_close($this-&gt;db_connect);
    }

}
?&gt;
</code></pre>

<p>in config.php i using:</p>

<pre><code>&lt;?php
include_once 'class.database.php'; 

$config['hostname'] = 'localhost';
$config['dbuser'] = 'root';
$config['dbpass'] = '';
$config['dbname'] = 'test';

$db = new Database($config); 
?&gt;
</code></pre>

<p>And test.php i using:</p>

<pre><code>&lt;?php
include 'config.php';
include 'class.database.php';
</code></pre>

<p>when to run test.php in wampserver is host alert error is <code>Fatal error: Cannot redeclare class Database in class.database.php on line 2</code></p>

<p>How to fix it ?</p>
