gglgokop1704
Programmer
Dear All,
Please I have written a php program to connect to a PostgreSQL database and select contents of a table and print it on the browser. But 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. 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);
?>
Any help is appreciated
Regards
Gokop
Please I have written a php program to connect to a PostgreSQL database and select contents of a table and print it on the browser. But 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. 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);
?>
Any help is appreciated
Regards
Gokop