在数据库YII中找不到活动记录类“Users”的表“users”

时间:2014-06-14 12:49:24

标签: php activerecord yii

enter image description here我试图调用getMenu()中的函数(CommonFunction.php)(location:components / CommonFunction.php),这将返回一些用户数据,但是当我转移了我的从godaddy(共享主机)到resellerclub(共享主机)的应用程序,显示错误。

表"用户"对于活跃的记录类"用户"无法在数据库中找到

  1. 表存在于数据库
  2. 用于检查模型的文件和类名的字母大小写
  3. 使用正确的数据库连接
  4. abc()中创建了一个功能(比如CommonFunctions.php),该功能可以成功获取用户信息。
  5. 当试图从getMenu()调用上面提到的abc()时,它再次显示上面的错误
  6. 能够从我的其他控制器调用getMenu函数,但没有问题
  7. 但是当我试图从这个特定功能调用getMenu时,它显示错误
  8. 如果为第一次提取分配了静态值,则会在同一功能中显示下一次提取的错误。
  9. commonFunction.php

       public static function GetMenu($user_id = 0) {
    
        $user_info = Users::model()->findByPk($user_id);
        if (!isset($user_info) || count($user_info) < 1)
            return;
        $user_profile = UserProfile::model()->find('user_id=:user_id', array(':user_id' => $user_id));
        $creteria = new CDbCriteria();
        $creteria->condition = "contributor=\"$user_info->user_name\"";
        $photo_upload_count = Godown::model()->count($creteria);
    
        $creteria = new CDbCriteria();
        $creteria->condition = "user_email=\"$user_info->email\"";
        $photo_purchase_count = Downloads::model()->count($creteria);
    
        //echo $photo_purchase_count; exit;
        $creteria = new CDbCriteria();
        $creteria->condition = "contributor_user_name=\"$user_info->user_name\"";
        $photo_sale_count = Downloads::model()->count($creteria);
        //echo $photo_sale_count; exit;
    
        $base = Yii::app()->getBaseUrl(true);
        $profile_pic_org = false;
        $profile_dummy = "$base/images/profile-img.jpg";
        if (isset($user_profile->profile_pic) && $user_profile->profile_pic != '') {
            $profile_pic_url = "$base/profile-pic/thumb/" . $user_profile->profile_pic;
            $profile_pic_org = "$base/profile-pic/" . $user_profile->profile_pic;
        } else {
            $profile_pic_url = "$base/images/profile-img.jpg";
            $profile_pic_org = "$base/images/profile-img.jpg";
        }
        if (isset($user_profile) && count($user_profile) > 0) { // profile for the user is almost complete , we can fetch that info too;
            $name = $user_profile->first_name . ' ' . $user_profile->last_name;
        } else {
            $a=explode('@', $user_info->email);
            $name = reset($a);
        }
        if ($user_info->user_type == 'c') { // find the statics if and only if the user is a contributor
            $creteria = new CDbCriteria();
            $creteria->condition = "contributor=\"$user_info->user_name\" and display_status =\"\"";
            $photo_pending_approval_count = Godown::model()->count($creteria);
    
            $creteria = new CDbCriteria();
            $creteria->condition = "contributor=\"$user_info->user_name\" and display_status =\"N\"";
            $photo_rejected_count = Godown::model()->count($creteria);
    
            $creteria = new CDbCriteria();
            $creteria->condition = "contributor=\"$user_info->user_name\" and display_status =\"Y\"";
            $photo_accepted_count = Godown::model()->count($creteria);
            $folder = self::GetUploadFolder($user_id);
            $folder = $folder['orginal'];
            $penging_file_count = 0;
            //echo $folder; exit;
    
        }
    

0 个答案:

没有答案