Dear All,
Thanks MercJones, I have used the code you sent to customise it according to my details but Please how can I run the PHP program to connect to a PostgreSQL database and select contents of a table and print it on the browser. I could not run the program. I don't know how to run it or perhaps how to activate the php. I have done some configurations on httpd.conf and php.ini files after installing php. See the program below:
<?php
// Connecting, selecting database
$dbconn = pg_connect("host=138.250.104.227 dbname=rftDatabase user=globus password=globususer");
// Performing SQL query
$query = 'SELECT * FROM Criteria_Parameters';
$result = pg_query($query);
// Printing results in HTML
echo "<table>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
pg_free_result($result);
// Closing connection
pg_close($dbconn);
?>
Is it possible to put the code int a function and then execute the function on a click of a button?
Any help is appreciated
Regards
Gokop