Re: getting pg_connect error?
| From: | Andrew Ziem | Date: | Sun, 06 Apr 2003 22:09:11 +0000 |
| Subject: | Re: getting pg_connect error? | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26872@lists.php.net to get a copy of this message | ||
Cornelia Boenigk wrote:
Hi AndrewI can do it with PHP and MySQL! =) How about this. Can I list PostgreSQL database files from PHP? With MySQL and PHP, I just connect to the server. Then, I can query whether the database file exists ("SHOW DATABASES"). If not, I create it. How do I do that with PostgreSQL?You're right. That was a typo in the newsgroup, but pg_last_error() still doesn't work because $rc is boolean, not a resouce connectiontype. If your connection to the database server fails you cannot get any error-message from the server ;-)
function open() { $rc = @pg_connect("db=wishiwhereusingmysql"); if (!$rc) { echo "Connection failed"; } else { return ($rc); } } Regards Conni