Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9B32F633B67 for ; Mon, 27 Apr 2009 16:56:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 90576-08 for ; Mon, 27 Apr 2009 16:56:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from asmtpout021.mac.com (asmtpout021.mac.com [17.148.16.96]) by mail.postgresql.org (Postfix) with ESMTP id 9B2BB63381D for ; Mon, 27 Apr 2009 16:56:27 -0300 (ADT) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from [10.0.1.2] ([71.63.79.39]) by asmtp021.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KIR00CCLZDZYW20@asmtp021.mac.com> for pgsql-php@postgresql.org; Mon, 27 Apr 2009 12:56:25 -0700 (PDT) Message-id: From: Thomas Hart To: pgsql-php@postgresql.org Subject: Newbie Question-Quoting SQL Date: Mon, 27 Apr 2009 15:56:23 -0400 X-Mailer: Apple Mail (2.930.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/13 X-Sequence-Number: 4018 I have some old forms that I used for MySQL a few years ago, and I'm trying to use the with postgres, but I keep on getting a message that the query failed. The connection string seems to be okay: $link = pg_connect("host=localhost port=5432 dbname=toms_stuff user=postgres password=********"); The query string, however, seems to be messed up. $result = pg_query ($link, "Select * from Author"); if (!$result) { echo "Query failed.\n"; exit; } I assume the fault is in how the Select statement is quoted, but I can't see what I'm doing wrong. Any suggestions will be appreciated. Also can anyone give me a general idea of the rules for quoting postgreSQL in PHP? Thanks for any help you can give. Tom Hart