How do I get different return value in controller from model?
<p>below code success to the search result from db, but I have 2 question:   </p>

<ol>
<li><p>How do I get different return value in controller from model?<br>
(If the result is $list_er ='can't find search word' how to show it)  </p></li>
<li><p>How to avoid if type space in form, submit will get all data list from db?</p></li>
</ol>

<p>controller.php</p>

<pre><code>...
public function temp_index(){
    require 'temp_index.php';
    if($_REQUEST['submit'] == 'get_all'){
        $result = $this -&gt; model -&gt; get_all();
        require 'get_all.php';
    }
    else if($_REQUEST['submit'] == 'get_search'){
        $result = $this -&gt; model -&gt; get_search();
        require 'get_search.php';
    }
}
</code></pre>

<p>model.php</p>

<pre><code>...
public function get_search($search){
    $search = mysql_real_escape_string($_POST['search']);
    $sql = "select * from p_ac where ac_email like '%$search%'";
    $query = mysql_query($sql) or die(mysql_error());
    if(mysql_num_rows($query) &gt; 0){
        $list_ar = array();
        while($list = mysql_fetch_array($query)){
            $list_ar[] = $list;
        }
        return $list_ar;
    }
    else{
        $list_er = 'can\'t find search';
        return $list_er;
        }
}
</code></pre>

<p>get_search.php</p>

<pre><code>&lt;div class="reslt_get_search"&gt;
&lt;?php foreach ($list_ar as $list) : ?&gt;
    &lt;div&gt;&lt;?php print"$list[ac_id]";?&gt;&lt;/div&gt;
&lt;div&gt;&lt;?php print"$list[ac_email]";?&gt;&lt;/div&gt;
&lt;?php endforeach; ?&gt;

&lt;div&gt;&lt;?php print"$list_er";?&gt;&lt;/div&gt; // How do I get this var (string)
&lt;/div&gt;
</code></pre>
