troubleshooting Question

getting number of records in advance

Avatar of msosno
msosno asked on
Web Languages and StandardsPHP
4 Comments1 Solution196 ViewsLast Modified:
I am reading records from the database. The data is being fetched by a complicated query that selects certain rows from several tables.

If there are many records, the page may take a few minutes to load (we will split the data over several pages in the future). I need to show a warning that the page will take some time to load and confirm that the user wants to proceed.

Is it possible to get the number of records in advance? For example, from  php resource variable?

Currently I am just fetching records with pg_fetch_row and counting them (e.g. $row_counter++). I am sure there should be a better way.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros