|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-15 04:37 UTC] sander@php.net
[2002-08-15 04:54 UTC] jc at mega-bucks dot co dot jp
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 20:00:01 2025 UTC |
It seems that I cannot use pg_pconnect to connect to more than on database at a time? The following code fails with this error: Warning: pg_pconnect() cannot create new link. Too many open links (1) in /www/htdocs/jc/t2.php on line 26 Warning: pg_exec(): supplied argument is not a valid PostgreSQL link resource in /www/htdocs/jc/t2.php on line 27 CONNECTION: could not execute query2 (select now()) <?php $sql = "select now()"; //uncommenting one of the following lines will make the code work $res1 = sql_query($sql); $res2 = sql_query2($sql); $dat = pg_fetch_object($res1); //or res2 as the case maybe echo $dat->now; function sql_query($sql) { $conn = pg_pconnect("dbname=JC user=postgres"); $res = pg_exec($conn, $sql); if (!$res) { echo "CONNECTION: could not execute query ($sql)<br>"; die; } else { return $res; } } function sql_query2($sql) { $conn = pg_pconnect("dbname=sessions user=postgres"); $res = pg_exec($conn, $sql); if (!$res) { echo "CONNECTION: could not execute query2 ($sql)<br>"; die; } else { return $res; } } ?>