Skip to main content
Topic: Register new user fatal Error (Read 5252 times) previous topic - next topic

Register new user fatal Error

In classic , when going live and tried to register a new user, i get this.

Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'contest.Users' doesn't exist in /data/sites/web/xxx/www/contest/app/models/PDODb.php:1042 Stack trace:
#0 /data/sites/web/xxx/www/contest/app/models/PDODb.php(1042): PDOStatement->execute()
#1 /data/sites/web/xxx/www/contest/app/models/PDODb.php(1076): PDODb->get('Users', 1, '*')
#2 /data/sites/web/xxx/www/contest/app/models/PDODb.php(951): PDODb->getOne('Users')
#3 /data/sites/web/xxx/www/contest/app/controllers/IndexController.php(138): PDODb->has('Users')
#4 /data/sites/web/xxx/www/contest/system/Router.php(227): IndexController->register()
#5 /data/sites/web/xxx/www/contest/system/Router.php(92): Router->run('index/register')
#6 /data/sites/web/xxx/www/contest/index.php(85): Router->init()
#7 {main} thrown in /data/sites/web/xxx/www/contest/app/models/PDODb.php on line 1042


my db is contest
my user table is : users and not Users
on local, ( xampp ) it works fine

What does it means ?
Thanks

Re: Register new user fatal Error

Reply #1
Here is the culprit...

into indexController , the table name is modified and start with a Capital. On my local server it has no impact but online it has.
So , if i change Users to users , it works online too.

   //Check if Duplicate Record Already Exit In The Database
         $db->where('accountname',$modeldata['accountname']);
         if($db->has('Users')){
            $this->view->page_error[] = $modeldata['accountname']."Already exist!";
         }
         //Check if Duplicate Record Already Exit In The Database
         $db->where('email',$modeldata['email']);
         if($db->has('Users')){
            $this->view->page_error[] = $modeldata['email']."Already exist!";
         }
         if( empty($this->view->page_error) ){
            $rec_id = $db->insert('Users',$modeldata);
            if(!empty($rec_id)){
            redirect_to_page("index/send_verify_email_link/$modeldata[email]");
               return;
            }

I don't know why the table name is modified when publishing project. It may be a bug.

Can you please check this and advice.

Thanks
Eroll

Re: Register new user fatal Error

Reply #2
Normally SQL table and fields name are not case sensitive. I believe it must be a settings on the server.
But we will put in check to use the actual database case.

Thanks

 

Re: Register new user fatal Error

Reply #3
Here , on my server ( shared one) it's define with Case Sensitive and cannot be change.
Thanks to take care of this for the next release and in the meantime , if you have a workaround to avoid this, it will be great.

I mean when publishing (Because i have to think about that on every publish )

Cheers
Eroll