0

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

$host="localhost";
$username="";
$password="";
$db_name="database";
$tbl_name="members";


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.

4
Contributors
9
Replies
10
Views
5 Years
Discussion Span
Last Post by abelingaw
0

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

Edited by kekkaishi: n/a

0

Cannot Find Database

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

Edited by abelingaw: n/a

0

Change DB name but still get the same output..

Even checked privileges and their all fine. But still.

1

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

Votes + Comments
good advice. displaying the exact error is most important while debugging.
0

It returns this error:

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

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.