Page 1 of 1

unable to connect to mysql database in Wamp5 Options

Posted: Wed Jul 25, 2007 4:11 am
by scout3014
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi 

I am currently doing a web project using wamp5. Right now this is how 
i am connecting to the database:

Code: Select all

$con = mysql_connect("localhost", "root", ""); 
if (!con) { 
   die('Could not Connect' . mysql_error()); 
   } 
if (!mysql_select_db("Leave", $con)){ 
    die (mysql_error()); 
} 

else { 
....... 
}

When the code above is activated, this is the result: ---> "Unknown database 'leave' "

Right now i am looking at 3 possibilities:
1)Could there be anything in mysql that i might have done wrong that triggers the error?
2)There is a problem in my $con object in the 1st place?
3)Certain configurations in e SQLite may hav sth to do with tis. (yes, the error message refers to "leave"
whilst the db select call is for "Leave")


Help is much appreciated


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Jul 25, 2007 7:11 am
by miro_igov
WTH is if (!con) { ?

Variables start with $ constants don't start. I don't see the constant con defined so maybe you miss the $

1) The error means that there is no database "leave" , make sure this database exists.
2) $con is not an obejct but resource
3) i can't understand what you actually ask and how SQLite is involved.