total row count for selects with a limit - Mailing list pgsql-php

From Peter
Subject total row count for selects with a limit
Date
Msg-id 005001c176c3$ef8d4e00$0300000a@600mlPeterPC1
Whole thread Raw
List pgsql-php
Hi there,
 
what seems to be the best way of getting the total row number on select queries with a limit on them?
 
What I am currently thinking of doing is building select queries dynamically and wrapping all selected fields into the count() function without the limit
 
somthing like:
 
select a,b,c from table limit 10
 
and for total count
 
select count(a,b,c) from table
 
and a function to build the select query with parameters such as
 
function build_select($table, $cols=array(), $limit, $orderby, $where) { ... }
 
I am going in the right direction? Instead of one query I need 2 is there a way of making it just one query?
 
thanks for any help
 
regards, Peter

pgsql-php by date:

Previous
From: "Millsap, Michael G"
Date:
Subject: PostgreSQL pseudo cluster
Next
From: "Dan Wilson"
Date:
Subject: Re: Connection problem