Skip to main content
Topic: Error "PDOException: SQLSTATE[42S02]" when upload to hosting  (Read 1672 times) previous topic - next topic

Error "PDOException: SQLSTATE[42S02]" when upload to hosting

Hello,
 When i upload code to VPS user Wordops, my website have error when i login, logout and view detail. How to fix this error?
Thank,
Error Message   
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hoai_name_vn_pXdHTAjE.app_logs' doesn't exist in /var/www/hoai.name.vn/htdocs/app/models/PDODb.php:459 Stack trace: #0 /var/www/hoai.name.vn/htdocs/app/models/PDODb.php(459): PDOStatement->execute() #1 /var/www/hoai.name.vn/htdocs/app/models/PDODb.php(1151): PDODb->buildInsert('app_logs', Array, 'INSERT') #2 /var/www/hoai.name.vn/htdocs/system/BaseController.php(544): PDODb->insert('app_logs', Array) #3 /var/www/hoai.name.vn/htdocs/app/controllers/IndexController.php(37): BaseController->write_to_log('userlogin', 'true') #4 /var/www/hoai.name.vn/htdocs/app/controllers/IndexController.php(89): IndexController->login_user('xxx', 'xxx', 'true') #5 /var/www/hoai.name.vn/htdocs/system/Router.php(196): IndexController->login(Array) #6 /var/www/hoai.name.vn/htdocs/system/Router.php(109): Router->run('index/login/') #7 /var/www/hoai.name.vn/htdocs/index.php(106): Router->init() #8 {main}
File
/var/www/hoai.name.vn/htdocs/system/BaseController.php On Line 547
Stack Trace
1 /var/www/hoai.name.vn/htdocs/app/controllers/IndexController.php(37): BaseController->write_to_log('userlogin', 'true')
2 /var/www/hoai.name.vn/htdocs/app/controllers/IndexController.php(89): IndexController->login_user('xxxx', 'xxxx', 'true')
3 /var/www/hoai.name.vn/htdocs/system/Router.php(196): IndexController->login(Array)
4 /var/www/hoai.name.vn/htdocs/system/Router.php(109): Router->run('index/login/')
5 /var/www/hoai.name.vn/htdocs/index.php(106): Router->init()

Re: Error "PDOException: SQLSTATE[42S02]" when upload to hosting

Reply #1
@hoaicao‍  please make sure that the app_logs table exists in your database, or you need to disable the Audit Trail from your project. You are getting the error because you configured the Audit Trail for some actions like login. When you try to log in, it tries to log details about the login action but cannot find the table to log the details to.