This topic is locked

Limiting Export Data

1/28/2007 9:27:48 AM
PHPRunner General questions
N
nickrix author

Hi All,

Im new here but i hope someone can help me.

I am currently using PHPRunner 3.1 and i would like to know if there is a way of limiting the number of records exported and also returned by a search.
1 limit number of records exported -

i would like to limit the number of records exported to 50
2 I would like ot limit the search results to 50. If more than 50 results will appear i would like there to be a message on the search page saying please refine your search. too many results!

Is this possible??
cheers

J
Jane 1/29/2007

Hi,
please see my answers below:

  1. to limit the number of exported records open ..._export.php file, find following line:
    $strSQL.=" limit ".(($mypage-1)*$nPageSize).",".$nPageSize;

and replace it with this one:

$strSQL.=" limit 49";



And then choose Current page only option on the Export page.
2. to limit the search results open ..._list.php file, find this line:

LogInfo($strSQL);

and add following code just before:

$str1 = "select count(*) from ".$strTableName." ".substr($strSQL,strpos($strSQL,"where"));

$str2 = substr($strSQL,0,strpos($strSQL,"where"));

$rs = db_query($str1,$conn);

$data = db_fetch_numarray($rs);

if ($data[0]>50)

{$strSQL=$str2." where 1=0";

?><script>

alert("please refine your search. too many results!");

</script><?php

}