所以,我正在尝试使用 PHP 向 PostgreSQL 表中插入一些寄存器。
我有一张career
表,寄存器在 school_careers.sql 中。所以我试过这个:
$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);
但我只是得到:
Cannot execute query: \i ./school_classes.sql