[請益] php connect postgreSQL

看板PHP作者 (====ONLYway)時間18年前 (2007/05/20 00:49), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
php code : <?php $fileptr = fopen("./param_connexion", "r") or die("open error"); $connexion = fgets($fileptr, 100); fclose($fileptr); $conn = pg_connect($connexion) or die("could not connect"); $sql = "select nextval('port')"; //$sql = "select * from port"; $res = pg_query($conn,$sql); if($res) { echo "true"; } else { echo "false"; } ?> ========== 其中 param_connexion 是我連線的基本組態(內容如下) ========== host=localhost port=5432 dbname=videostream user=administrator password=administrator ========== 其中 port 是 序列數(SQL 內容如下) =========== CREATE SEQUENCE port INCREMENT 4 MINVALUE 25000 MAXVALUE 65000 START 25408 CACHE 1 CYCLE; ALTER TABLE port OWNER TO antonio; GRANT ALL ON TABLE port TO antonio; GRANT SELECT ON TABLE port TO administrator; Q: if SQL query is -----> $sql = "select * from port" $res return value is true if SQL query is -----> $sql = "select nextval('port')"; $res return value is false plz ...tell me why... thanks -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.113.65 ※ 編輯: TheOnlyWay 來自: 220.132.113.65 (05/20 00:51)
文章代碼(AID): #16JoglGh (PHP)
文章代碼(AID): #16JoglGh (PHP)