user3416605
user3416605

Reputation: 79

Table 'users.users' doesn't exist

I am trying to set up a simple log in sign up system, but when I try to run this query:

$query = mysql_query("SELECT * FROM users WHERE username='$user'") or die(mysql_error());

I get the error:

Table 'users.users' doesn't exist

Is there any way I could fix this? I know I am putting in the right table name.

Thank you for your help!

Upvotes: 0

Views: 5126

Answers (2)

nanobash
nanobash

Reputation: 5500

Try this one:

$query = mysql_query("SELECT * FROM `userdatabase.users` WHERE username='$user'") or die(mysql_error());

From your example it seems that you have chosen different database than userdatabase, because the table is not found, so if you're dealing with tables from marked database, it's good way to change working database to userdatabase and then execute queries without namespace

See mysql_select_db (just mentioning mysql extension because you're using it) for database changing porpose, though get rid of mysql extension

Upvotes: 1

Pinki
Pinki

Reputation: 1042

Aber connecting to your database server, you need to select your database.

mysql_select_database('databasename');

Not sure if that is the correct functionname

Upvotes: 0

Related Questions