how create customize search

hello dear all,

i’m facing a problem and i need someone help,

i have two tables with relations between those tables , i want to create a search form and perform a search between those tables , i already customize the advance search… my query is something like this:

SELECT c.date,c.name,c.age,b.name FROM client c INNER JOIN bon b ON b.clientId = c.id WHERE c.name = $_GET[‘name’] AND c.date BETWEEN $_GET[‘date1’] AND $_GET[‘date2’];

the real problem is my form ,it looks like this:

<div class="row">

	&lt;?php echo &#036;form-&gt;label(&#036;model,'START DATE'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'demission',array('size'=&gt;45,'maxlength'=&gt;45)); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;label(&#036;model,'END DATE'); ?&gt;


     &lt;?php echo &#036;form-&gt;textField(&#036;model,'demission',array('size'=&gt;45,'maxlength'=&gt;45)); ?&gt;


&lt;/div&gt;

has seen in this form,i’m using the same demission two times as textField name to perform my query because this model row demission is containing the date to perform my query

how to solve that problem?

i’m confuse,i’m really don’t know how to solde.

Hello Didier

The idea is to:

[list=1]

[*]Declare two virtual attributes in your Model for the date range limits

[*]Use them in your view’s advanced search form

[*]Use them as well is your Model’s search method

[*]Also you may want to use CJuiDatePicker instead of textfields

[*]And of course forget about your demission attribute in your search form

[/list]

Here’s a recent post about it: http://www.yiiframework.com/forum/index.php/topic/31752-date-range-search/ You’ll find other ones for sure

thanks sir, it’s exactly what i was looking for