MySQLi Display Record Numbers

Record counters give users a reference point when they are navigating through a set of records. Typically, record counters display the total number of records returned, and the current records being viewed. For example, if a recordset returns 40 individual records, and 8 records are displayed per page, the record counter on the first page would indicate “Displaying records 1‑8 of 40.”

Before you create a record counter for a page, you must create a recordset for the page, an appropriate page layout to contain the dynamic content, and then a recordset navigation bar.

Record counters let users know where they are within a given set of records relative to the total number of records returned. For this reason record counters are a useful behavior that can significantly add to the usability of a web page.

Create a simple record counter by using the Recordset Navigation Status server object. This server object creates a text entry on the page to display the current record status. You can customize the record counter by using Dreamweaver page-design tools.

  1. Place the insertion point where you want to insert the record counter.
  2. In the Server Behaviors panel (Window > Server Behaviors), click the plus (+) button and choose WebAssist > MySQLi > Display Record Count > MySQLi Display Starting Record and then select the recordset from the Recordset pop‑up menu, and click OK.

    The recordset record display server object inserts a text record counter that appears similar to the following example:

    Text record counter

    When viewed in Live view, the counter appears similar to the following example:

    Text record counter in Live Data window

 

To display the starting record number returned by your recordset, access the Server Behaviors Panel and click plus (+) > WebAssist > MySQLi > Display Record Count > MySQLi Display Starting Record. Then select the recordset you would like to display a counter for and click OK.

To display the ending record number returned by your recordset, access the Server Behaviors Panel and click plus (+) > WebAssist > MySQLi > Display Record Count > MySQLi Display Ending Record. Then select the recordset you would like to display a counter for and click OK.

To display the total number of records returned by your recordset, access the Server Behaviors Panel and click plus (+) > WebAssist > MySQLi > Display Record Count > MySQLi Display Total Records. Then select the recordset you would like to display a counter for and click OK.