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

  • SEARCH
  • Home
  • 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 8392995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:40:11+00:00 2026-06-09T19:40:11+00:00

UPDATE2: I’ve created a new WebUser.php component in /protected/components as follows: <?php class WebUser

  • 0

UPDATE2:

I’ve created a new WebUser.php component in /protected/components as follows:

<?php
class WebUser extends CWebUser{
private $_model;

function getId(){
    $user = $this->loadUser(Yii::app()->user->id);
    return $user->id;
}

protected function loadUser($id=null){
    if($this->_model===null)
    {
        if($id!==null)
        {
            $this->_model=Users::model()->findByPk($id);
        }
        return $this->_model;
    }       
}
}

I’ve registered the component in main.php as well. After uploading changes, my app still states that WebUser.getId is not defined.

UPDATE:
After making changes and then rolling them back, I’m getting a new error:

Property "CWebUser.getId" is not defined. 

The snippet of code in question is:

$user = Users::model()->find('username=?', array(
Yii::app()->user->getId));    

How and where should getId be set to reference the $id field in the Users model?

My UserController is throwing the following SQL Error:

CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number:     
parameter was not defined. The SQL statement executed was: SELECT * FROM `users` `t` WHERE 
username=? LIMIT 1 

The error is being caused by this snippet of the controller:

public function actionProfile($id=''){        

        $user = Users::model()->find('username=?', array(Yii::app()->user->getId()));
        if(!$id){
            $id = $user->id;
            if(!$id)
            $this->redirect('login');
        }
        if( getUserSess('user_type') == 'Sitter') {
            $this->render('profile_detail', array('user_id' => $id ));
        } else {
            $this->render('petowner_profile_detail',array(
        'model'=>$this->loadModel($id),
    ));
        }
    }

The profile_detail view is as follows:

<?php
if(!$user_id){
    $user_id = getUserSess('id');
}
$this->widget('ext.UserProfile.BasicProfile',array('user_id'=>$user_id)); ?>
<?php //$this->widget('ext.UserProfile.UserServices',array('user_id'=>$user_id)); ?>

The petowner_profile_detail view is as follows:

<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
    'username',
    'email',
    'phone',
    'fname',
    'lname',
    'address1',
    'address2',
    'city',
    'state',
    'zip',
    'is_year_old',
    'user_type',
//      'register_date',
//      'varified_date',
//      'is_premium',
//      'last_login',
),
)); ?>

How do I rectify he SQL error?

  • 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-06-09T19:40:13+00:00Added an answer on June 9, 2026 at 7:40 pm

    UPDATE:

    $user = Users::model()->find(‘username=:id’, array(“:id” => Yii::app()->user->id));

    UPDATE2:

    Yii::app()->user->getId() or Yii::app()->user->id not Yii::app()->user->getId

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

Sidebar

Related Questions

UPDATE2: I think I got it now: <?php /* * @name Lawler's algorithm PHP
Win7 x64, Delphi Xe2 update2 Prompt: The new project, compile as x32, are applied
I'm quite new with PHP/Jquery and I am trying to do an update password
Update2: What I really wanted to ask was already argued in a different page.
UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:
UPDATE2: Tried rendering just a quad. UPDATE: The FULL code is here. Somebody can
Update2: For now, I'm considering saving a temporary copy of the document in html
I'm using a php script to download large files from a server and then
Example class User has_many :tickets end I want to create association which contains logic
[Update2] So is it OK that when I run git from the CLI it

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.