I can't figure out what is wrong since my codes are correct.


mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("Cannot Find Database");

Keeps on saying the die statement.

I'm using WAMP, and yes. my database name is "database" and table is name is "member".
Or is my db name is a reserve word.

"database" is a reserved word in mysql. Which die statement is it printing? Cannot connect or the Cannot Find Database?

Cannot Find Database

So i should change my db name then? or something else is wrong.

Try not to use the reserved keywords. So try changing the name. It just might be it.

Change DB name but still get the same output..

Even checked privileges and their all fine. But still.

you could try putting mysql_error() in you die() area, see what that gives back

commented: good advice. displaying the exact error is most important while debugging. +5

It returns this error:

Access denied for user ''@'localhost' to database 'students'

Your database seems to be password protected.

Management software like phpmyadmin usually have default usernames/password, try something like root or administrator etc.
I'm sure you can find it on the internet: i don't know those defaults out of my head

Try to use the default username = root and default password if you havent changed it.

Solved, thanks rotten and all who replied..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.