0

I am attempting to transfer data from my Posgtresql database onto a locally hosted website through MAMP.

My coding is simple enough, as follows;

<html>

  <head>
   <title>Test</title>
  </head>
<p>Stuff</p>
 <?php
   $host        = "host = 127.0.0.1";
   $port        = "port = 5432";
   $dbname      = "dbname = HappyTravels";
   $credentials = "user = postgres password=[password_redacted]";

   $db = pg_connect( "$host $port $dbname $credentials"  );
   if(!$db) {
      echo "Error : Unable to open database\n";
   } else {
      echo "Opened database successfully\n";
   }
?>

However, when I host this page onto my MAMP, the only thing that shows is the "Stuff" text, with anything to do with php completely invisible.

Am I missing something here? I apologise for my lack of PHP knowledge in advance, Thanks!

0 Answers0