Hello,

This is a long-shot - but I have been having errors (error message):

Unknown database 'mydb'

(where mydb is the name of my mysql db)

I am currently using prohosting.
These tend to happen ad hoc (ie there is no pattern).

My db connection script is:

<?php
function fatal_error($message)
{
$err="Error: ".mysql_errno()." ".mysql_error();
echo $err;
)
//create connection to database
$connection = mysql_pconnect("localhost","mydb","mypassword")
or die(fatal_error("Couldn't connect to server"));

// select database
$db = mysql_select_db("mydb", $connection)
or die(fatal_error("Couldn't select database."));
?>

I don't think there is anything wrong with the script since it has remained unchanged for over 6 months.

I am using php4pl1.

Many Thanks for any help
Dipen

    hi,

    the code is fine.

    run this command on the MYSQL client or through PhpMyAdmin

    use mydb;

    if it tells no database found, then ur database is not there and is dropped. make it again; create the tables and start from scratch

    kalyan

      Hi Kalyan,

      Thank you for your reply.
      However, the problem is not with the database not being there (although the error message states this) - since staff accessing this website can actively perform db operations.

      Many Thanks
      Dipen

        Write a Reply...