Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid Parameter Number. Parameter not defined
    primarykey
    data
    text
    <p>UPDATE2: </p> <p>I've created a new WebUser.php component in /protected/components as follows:</p> <pre><code>&lt;?php class WebUser extends CWebUser{ private $_model; function getId(){ $user = $this-&gt;loadUser(Yii::app()-&gt;user-&gt;id); return $user-&gt;id; } protected function loadUser($id=null){ if($this-&gt;_model===null) { if($id!==null) { $this-&gt;_model=Users::model()-&gt;findByPk($id); } return $this-&gt;_model; } } } </code></pre> <p>I've registered the component in main.php as well. After uploading changes, my app still states that WebUser.getId is not defined. </p> <p>UPDATE:<br> After making changes and then rolling them back, I'm getting a new error:</p> <pre><code>Property "CWebUser.getId" is not defined. </code></pre> <p>The snippet of code in question is:</p> <pre><code>$user = Users::model()-&gt;find('username=?', array( Yii::app()-&gt;user-&gt;getId)); </code></pre> <p>How and where should getId be set to reference the $id field in the Users model?</p> <p>My UserController is throwing the following SQL Error:</p> <pre><code>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 </code></pre> <p>The error is being caused by this snippet of the controller:</p> <pre><code>public function actionProfile($id=''){ $user = Users::model()-&gt;find('username=?', array(Yii::app()-&gt;user-&gt;getId())); if(!$id){ $id = $user-&gt;id; if(!$id) $this-&gt;redirect('login'); } if( getUserSess('user_type') == 'Sitter') { $this-&gt;render('profile_detail', array('user_id' =&gt; $id )); } else { $this-&gt;render('petowner_profile_detail',array( 'model'=&gt;$this-&gt;loadModel($id), )); } } </code></pre> <p>The profile_detail view is as follows:</p> <pre><code>&lt;?php if(!$user_id){ $user_id = getUserSess('id'); } $this-&gt;widget('ext.UserProfile.BasicProfile',array('user_id'=&gt;$user_id)); ?&gt; &lt;?php //$this-&gt;widget('ext.UserProfile.UserServices',array('user_id'=&gt;$user_id)); ?&gt; </code></pre> <p>The petowner_profile_detail view is as follows:</p> <pre><code>&lt;?php $this-&gt;widget('zii.widgets.CDetailView', array( 'data'=&gt;$model, 'attributes'=&gt;array( 'username', 'email', 'phone', 'fname', 'lname', 'address1', 'address2', 'city', 'state', 'zip', 'is_year_old', 'user_type', // 'register_date', // 'varified_date', // 'is_premium', // 'last_login', ), )); ?&gt; </code></pre> <p>How do I rectify he SQL error?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload