Querying postgresql and displaying results on dynamic web page