You are here:  » Showing Total Record Count


Showing Total Record Count

Submitted by chrisst1 on Sat, 2013-02-16 11:46 in

Hi David

I am trying to show the total number of records per feed using $total as per http://www.pricetapestry.com/node/4956 in the demo script below. I got it to work but the script will only show the same record details for each record in the feed.

Could you take a look please.

Chris

{code saved}

Submitted by support on Sat, 2013-02-16 16:45

Hi Chris,

It looks like it's just the $total count code missing from the record handler function - where you currently have:

  function myRecordHandler($r)
  {
    global $count;
    global $page;
    global $record;
    $count++;
    $record = $r;
    return ($count == $page);
  }

...REPLACE with:

  $showTotal = TRUE;
  function myRecordHandler($r)
  {
    global $showTotal;
    global $total;
    global $count;
    global $page;
    global $record;
    $count++;
    $total++;
    if ($count==$page)
    {
      $record = $r;
    }
    if (!$showTotal) return ($count == $page);
  }

(I notice your code already check $showTotal elsewhere, so that should be all it is...)

Cheers,
David
--
MagicParser.com

Submitted by chrisst1 on Mon, 2013-02-25 14:21

Hi David

That did it, thanks.

Chris