Olaf Bohlen
2023-03-01 4f3af11ef04f34f43f99a47f5a310a781a5f4977
added db connection support
1 files modified
18 ■■■■■ changed files
index.php 18 ●●●●● patch | view | raw | blame | history
index.php
@@ -24,6 +24,24 @@
      echo "no other file found!";
    }
    echo '</p>';
    $host = $_ENV["DBHOST"];
    $user = $_ENV["DBUSER"];
    $pass = $_ENV["DBPASS"];
    $db = $_ENV["DBNAME"];
    $con = pg_connect("host=$host dbname=$db user=$user password=$pass")
        or die ("Could not connect to server\n");
    $query = "SELECT * FROM foo LIMIT 5";
    $rs = pg_query($con, $query) or die("Cannot execute query: $query\n");
    while ($row = pg_fetch_row($rs)) {
      echo "$row[0]\n";
    }
    pg_close($con);
?>
 </body>
</html>