The PHP Manual teaches the rudiment of getting a dataset from a PostgreSQL database. I followed it. Although it was successful, I was not satisfied with the way the dataset was presented over the web page: No information as to what the table is all about, no table heading, no border, the numbers were not aligned to the right, and no aggregate information (i.e., sumtotal). That gave me an overnight challenge (yes, I burned the midnight oil) to return the dataset with the problems cited solved. Success!
Look at the code I wrote: pgconnect2.pdf