Welcome Guest, Not a member yet? Register   Sign In
Best Practices for No Results from Database Query?
#2

[eluser]CroNiX[/eluser]
Assuming you are passing the array of results (or no results) why not just check it in the view? You don't need a separate view file for the error do you?
Code:
&lt;?php if(sizeof($results) < 1): ?&gt;
We are sorry, there were no results from your search.
&lt;?php else: ?&gt;
    &lt;?php foreach($results as $result): ?&gt;
        // display results
    &lt;?php endforeach; ?&gt;
&lt;?php endelse; ?&gt;


Messages In This Thread
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 04:02 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 05:32 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 05:52 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 06:08 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 06:16 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 06:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB