i have tried to call a function (getMenu()
) in CommonFunction.php
(location : components/CommonFunction.php) , which will return some user data, but when i transferred my application from godaddy (shared hosting) to resellerclub (shared hosting) , following error showing.
The table "users" for active record class "Users" cannot be found in the database
- table exists in database
- letter case for file and class name for model checked
- using the correct db connection
- created a function (say
abc()
) inCommonFunctions.php
which is successfully fetching user information. - when tried to call above mentioned abc() from getMenu() , it again showing above error
- am able to call the
getMenu
function from my other controllers but there is not issue for that - But when i tried to call getMenu from this specific function it is showing error
- If assigned a static value to first fetching, it will show error for the next fetching in the same function .
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;
}