: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database_name.users' doesn't exist in C:\xampp\htdocs\training\DB\loginn.php:19 Stack trace: #0 C:\xampp\htdocs\training\DB\loginn.php(19): PDOStatement->execute() #1 {main} thrown

1 Answer 1


Here is the solution:

Possible causes for this error include:

The table was never created in the database, either because the SQL script to create it was not executed, or there was an error in the script that prevented the table from being created.

The table was dropped or renamed after it was created, causing the script to fail when it tries to access it. The script is connecting to the wrong database, either because the database name in the script is incorrect or the script is connecting to a different database than intended. To resolve this issue, you should check that the table exists in the correct database and that the database name and table name in the script are correct. If the table doesn't exist, you should create it using a SQL script that defines its schema. If the table was dropped or renamed, you may need to restore it from a backup or recreate it from scratch.

  • thank you for the solution Mar 4, 2023 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.