Have you ever wanted to prevent your web application users displaying too many records in the List page? Well, I have, and this following trick will show you how you can limit the record count displayed in List page of your web applications that generated by PHPMaker so easily. This is very useful if you want to prevent your web application users displaying too many records, even the records are devided into several pages. In addition, this will also help you to control the bandwidth usage from your web applications.
We will use the Recordset_Selected server event for this. In other words, we will not modify any generated script files at all. Please note that in the following example below, we will search the records from the Advanced Search page, so that when the record count of the search result exceeds the certain value, then display a warning message to the user, and then redirect him back to the Advanced Search page immediately.
[hidepost]
-
Insert the following code into your Recordset_Selected server event:
$recCountResult = $rs->RecordCount(); // get the record count if ($recCountResult > 1000) { // adjust 1000 with yours $this->setWarningMessage("Too many records: <strong>".number_format($recCountResult, 0, ",", ",")."</strong>. Please narrow the date range as possible!"); // display a warning message to user $this->Page_Terminate("yourtablenamesrch.php"); // redirect him back to the Advanced Search page } - Finally, re-generate your script files using PHPMaker as always.
[/hidepost]
Hi,
Please, i wonder how I can export data in csv not with a comma but with semicolon ?
thanks !
Hi Thierry,
That’s a good question. Please follow this article for the answer: How to Change the Separator Character for Export to CSV in Websites that Generated by PHPMaker 9.2.0. Hope that helps.