How to alter the result of my view using filters? I have a view with 2 exposed filter.. I only want to change the result of my view when filters are used, ie if they have any value and press the button to run the filters.

I try to used the hook_views_pre_render, but doesn't work...

function node_db_views_pre_render(&amp;$view) {
   if($view-&gt;name=="demo" &amp;&amp; $view-&gt;current_display == 'page_1' &amp;&amp;  $view-&gt;exposed_input['date_filter'] != NULL) {
       $get_date = $view-&gt;exposed_input['date_filter'];
       $min = $get_date['min']['value'];
       $max = $get_date['max']['value'];

         $query_power = "SELECT h.id, h.name, count(c.room_id) as busy 
                         FROM table_1 c JOIN table_2 h ON c.id = h.id
                         WHERE '%s' &lt; c.in_date OR '%s' &gt; c.in_date
                         AND '%s' &lt; c.out_date OR '%s' &gt; c.out_date";

         $result = db_query($query_power, $min, $min, $max, $max);

       $items = get_rows($result); // this is a function gets the data from the sentence and makes a array.

       $view-&gt;result = $items;
   }
}


Exist other hook that can help me?..Thanks :D
you should use hook_views_query_alter, because hook_views_pre_render is called after the query is done, so you cannot influence your database request anymore.

The views documentation has been added to the Drupal api docs recently, so for more info look at:
http://api.drupal.org/api/views/docs%21views.api.php/group/views_hooks/7

or

http://views.doc.logrus.com/