This topic is locked

'Records Per Page' drop down displays all records

9/11/2008 10:03:56 PM
PHPRunner General questions
F
Frink09 author

I have a database with several thousand entries. It is currently set to not display all records if a blank search is performed, however if I use the 'Records Per Page' drop down and choose any of the options (10, 20, 30, 100, 500 etc.), the entire database will display! I would like to prevent this from happening! When users select the drop down and the search bar is empty it should return 'No Records Found'.
I have some code from a previous post that will probably do the job however I'm not sure which field to insert (the 'Records Per Page' field), and also what kind of event this is:
[codebox]global $gstrSQL;

if(!count($_GET) && !count($_POST) || @$_REQUEST["a"]=="search" && @$REQUEST["SearchFor"]=="" || @$_REQUEST["a"]=="advsearch" && @$_REQUEST["value_FieldName"]=="")

$strSQL = AddWhere($gstrSQL,"1=0");[/codebox]
Any help would be greatly appreciated. Thank you very much.

J
Jane 9/12/2008

Hi,
use following code in your event:

global $gstrSQL;

if(!count($_GET) && !count($_POST) || @$_REQUEST["a"]=="search" && @$REQUEST["SearchFor"]=="" || @$_REQUEST["a"]=="advsearch" && @$_REQUEST["value_FieldName"]=="")

$strSQL = AddWhere($gstrSQL,"1=0");
if (@$_REQUEST["pagesize"] && !@$_REQUEST["a"] && !$strWhereClause)

$strWhereClause = whereAdd($strWhereClause,"1=0");

F
Frink09 author 9/12/2008

Thank you very much. That worked like a charm!