SQLSTATE[42S02]: Base table or view not found: 1146 Table 'crm.email' doesn't exist (Connection: mysql, SQL: select count(*) as aggregate from `email`

✔ Recommended Answer

when the validation arrives to the email it looks in db for an email table, and it can't find it.

wha you are probably trying to do is to have a unique email but you have to tell laravel the correct table name to look for.

es:'email' => 'required|unique:tablename',

this will look for a unique email in a table named tablename.

Source: stackoverflow.com

Answered By: suxgri

Method #2

This error message is indicating that the SQL query is attempting to access a table named "email", but the table does not exist in the database.

There are a few possible reasons for this error:

  1. The table has not been created yet: Check if the table named "email" exists in the database. If not, you may need to create it before running the SQL query.

  2. The table has been deleted: If the table was previously created and is now missing, it may have been deleted. Check if the table has been deleted or dropped from the database.

  3. The table exists in a different schema: It is possible that the table exists in a different schema than the one you are currently connected to. Check if the table exists in a different schema and adjust your SQL query accordingly.

  4. The table name is incorrect: Verify that the table name "email" is correct and matches the name of the table in the database.

Once you have identified the issue, you can take the necessary steps to resolve it and execute the SQL query successfully.


Most Popular

PhpStorm, return value is expected to be 'A', 'object' returned

Remove Unicode Zero Width Space PHP

Laravel file upload returns forbidden 403, file permission is 700 not 755