Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6973761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:09:00+00:00 2026-05-27T17:09:00+00:00

This 3 tables are just a part of my entire project (users,profile,login) Login.php (

  • 0

This 3 tables are just a part of my entire project (users,profile,login)

Login.php (model for login table)

public function topten_logins(){

    $criteria = new CDbCriteria;
    $criteria->select = 'concat(u.firstname," ",u.lastname) as Name, p.join_date as Joined, count(*) as Logins';
    $criteria->alias = 'l';
    $criteria->join = 'left join users u on (u.id = l.user_id) left join profile p on (p.user_id = l.user_id)';
    $criteria->group = 'l.user_id';
    $criteria->order = 'Logins desc';
    $criteria->limit = '10';

    return new CActiveDataProvider($this, array(
        'criteria'=>$criteria,
    ));
}

and I have to display it in CGridView, and my code to display is as follows:

<?php $this->widget('zii.widgets.grid.CGridView', array(

    'dataProvider'=>Login::model()->topten_logins(),
    'enablePagination' => false,
    'columns'=>array(
        'Name',
        'Joined',
        'Logins',
        array(
            'class'=>'CButtonColumn',
        ),
    ),
)); ?>

I just want to display Top ten users who have most logins.

But it gives me error message that:

Property “Login.Name” is not defined.

I haven’t used Yii before. So, your help will be highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:09:00+00:00Added an answer on May 27, 2026 at 5:09 pm

    The problem is you are making query with ‘as Name and as Logins’. In this case, what you need to do is to define ‘Name’ and ‘Logins’ as a variable in your model. in the class definition of your model add

    public $Name;
    public $Logins; 
    

    And it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before anyone suggests scrapping the table tags altogether, I'm just modifying this part of
I have just created this table: create table dbo.OrderTypes ( ID smallint primary key
I have table and this table contain result column with some entries. I just
This is supposed to work yet just says no stocks table - supposed lost
I just saw this dating site on builtwithbootstrap and have a question about table
Just using this as an example... Here are the columns in my UserProfile table:
Help from the SQL Gods Required Table 1 - DistinctQuotes This tables holds information
The following function is designed to check whether this row in this tables exists.
I have Cinema table & City table and I have relation with this tables
I have Movie table & TblMovieVideos table and I have relations with this tables,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.