i like yii but

hello Dear ,

please help me, i’m not catching somethings in yii :

1)shall i write all my queries in my Models or shall i put its in my controllers.

2)how shall i use form data to make a query e.g i have a CFORM and user fill it and click on submit bouton how shall i do to write a query like this SELECT row FROM Mytable WHERE row = $_post/$_GET and where shall i write this querie.

please help me i think it’s the last step before doing my own tutorials.


you will change ‘like’ to ‘love’ and no ‘but’ once you know more about yii

  1. [controller] controls what to do and where to go; [model] actually does the job, so query goes model

  2. if you grab an existing yii application go a little deeper, eg. check SiteController.php

public function actionFeedback(){


  //this line will receive all values from form to model



i’m sorry sir, just two months i’m speaking english…

how shall i use variables $_get OR $_post to create a queries i suppose that variables are from a CFormModel filled by a user …what’s the best pratice to create a query in controller or in model


Read the documentation. Follow tutorials and download and examine applications made with Yii - instead of expecting us to answer all your basic questions.

thanks i have already read that book and i’m not catching that concept…i think i’ll go through google again may be i’ll get something.

one big difference between regular php form and yii generated form is


<input name="field1" type="text">

yii, which is array

<input name="model[field1]" type="text">

so in your model,

  //this line will receive all values from form to model


or individually

$email = $_POST['FeedbackForm']['email'];

$body =  $_POST['FeedbackForm']['body'];

every time, when you got the yii way, you would appreciate the smart design of yii

thanks very much sir this will help me.