Resolving a Base table or view not found Error
Introduction
This guide demonstrates how to resolve a Base table or view not found error which may be encountered during normal operation of WHMCS. The full error may look like:
Critical Error
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'table_whmcs7.tbldomainpricing_premium' doesn't exist
Cause
This error occurs when a required table is missing from the WHMCS MySQL database
In this example the tbldomainpricing_premium table does not exist. It should be present.
A missing table could be caused by an update failure in the past, or accidental/malicious removal of the table.
Resolution
The table identified by the error message must be re-created. Follow these steps:
1. Navigate to the /resources/sql/install/ directory
2. Identify the .schema.sql file with the filename corresponding to the missing table name. In this example that's tbldomainpricing_premium.schema.sql:
![Open the .schema.sql file for the missing table](https://media.screensteps.com/image_assets/assets/003/654/651/original/2b74a792-1de7-4520-a2b3-c9e10474a1d6.png)
3. Edit the file to view its contents
4. Copy the SQL CREATE TABLE command shown in the file. For example:
![Identify the CREATE Table command](https://media.screensteps.com/image_assets/assets/003/654/653/original/782c34de-804a-4ae1-8cdc-0876062c1c38.png)
5. Using a database administration tool such as phpmyadmin, execute the SQL command copied from the .schema.sql file. For example:
![Execute the CREATE TABLE command against the WHMCS Database](https://media.screensteps.com/image_assets/assets/003/654/649/original/431f8385-1ca4-4628-8fed-4cbf0e6b0494.png)
6. Ensure the create query executes successfully:
![Command Successful](https://media.screensteps.com/image_assets/assets/003/654/655/original/e6c2cd88-cb4a-4db9-a97a-4f165cbd5def.png)
7. You may now return to WHMCS and the error resolved. Repeat the process for any other missing tables.
If multiple tables are missing this may indicate a wider issue on the MySQL server, necessitating investigation by a server administrator instead.