\n"; echo "

\nYour query was:
\n$query\n

\n"; // Send the query retrieved from the form over to the DBMS. $result = pg_exec($db_h, $query); // If we successfully retrieved a result from the query, print the // fields of each row. Otherwise, print the error message the DBMS sent // us. if (!$result) echo pg_errormessage($db_h) . "
\n"; else { echo "The result is:
\n"; $rows = pg_numrows($result); $fields = pg_numfields($result); for ($i = 0; $i < $rows; ++$i) { for ($j = 0; $j < $fields; ++$j) echo pg_result($result, $i, $j) . "   "; echo "
\n"; } pg_freeresult($result); } echo "

\nTables: Student, Transcript, Users.
\n"; echo "Attributes of Student: Id, Name, Address, Status.
\n"; echo "Attributes of Transcript: StuId, CrsCode, Semester, Grade.
\n"; echo "Attributes of Users: Username, Password.
\n"; echo "

\n"; echo "Next SQL query: 
\n"; echo "\n"; echo "
\n"; } else { echo "Not authenticated.
\n"; pg_freeresult($result); } pg_close($db_h); ?>