title: PHP and PostgreSQL - insert rows from a SQL file
body: <p>SO, I'm trying to insert some registers to PostgreSQL table using PHP.</p>
  
  <p>I have a <code>career</code> table and registers are into school_careers.sql. So I've tried this:</p>
  
  <pre><code>$host = "localhost";
  $user = "user";
  $pass = "passw0";
  $db = "school";
  
  $con = pg_connect("host=$host dbname=$db user=$user password=$pass")
         or die ("Could not connect to server $server\n");
  
  $query = "\\i ./school_classes.sql";
  $rs = pg_query($con, $query) or die("Cannot execute query: $query\n");
  
  echo $rs . " done\n";
  
  pg_close($con);
  </code></pre>
  
  <p>But I just get:</p>
  
  <p><code>Cannot execute query: \i ./school_classes.sql</code></p>