I am trying to connect to a database on my localhost with Dreamweaver . When i try to create a recordset i get an unidentified error. Any ideas
I’ve got a brilliant idea.
Why don’t you paste here exact copy of this error message?
It was the record set a couple of days ago now it can’t connect to the database
<?php
function dbConnect() {
// Conect to the MySQL Server
if (!$connection=mysql_connect('hostname','database_user_name','database_user_password')) {
echo 'Database Connection Failure: Sorry, we regret that the server that the database is stored on is not responding.';
echo mysql_errno(connection) . ": " . mysql_error(connection). "\
";
die;
} else if ( !mysql_select_db($this->dbName,$connection ) {
echo 'Database Connection Failure: Sorry, we regret that the server is responding but the database refuses to load.';
echo mysql_errno(connection) . ": " . mysql_error(connection). "\
";
die;
} else {
echo 'Connection established!';
}
mysql_set_charset('utf8',$connection);
}
?>
Have you checked that you entered the db username, password and name of the database in correctly? If you have a @ in your connection script then it should be removed as the @ operator surpresses errors.