title: Will this PHP + postgreSQL code work? I'm coding blind!
body: <p>I have a strange question. I need to send some code to a client without having access to the server to test my code. In addition, it's using postgreSQL which I've never used, and I've not done PHP for a while!</p>
  
  <p>In order to save some time, I'd really appreciate if someone could tell me if this code will do what I want?</p>
  
  <h3>example feed</h3>
  
  <pre><code>&lt;?
  $sql = "SELECT * FROM V_SIDE_MENU_E";
  
  include 'db.inc.php';
  ?&gt;
  </code></pre>
  
  <h3>db.inc.php</h3>
  
  <pre><code>$connectString = 'host=localhost dbname=myDatabase user=foo password=bar';
  $link = pg_connect($connectString);
  
  if (!$link) {
      echo "error";
  } else {
  
  $result = pg_query($link, $sql);
  $rows = array();
  while($r = pg_fetch_assoc($result)) {
      $rows[] = $r;
  }
  print json_encode($rows);
  }
  </code></pre>