pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Hart <tehart@me.com>
To: pgsql-php@postgresql.org
Subject: Newbie Question-Quoting SQL
Date: Mon, 27 Apr 2009 15:56:23 -0400
Message-ID: <E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com>
Permalink:  ../E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com/
Also on:    postgresql.org/message-id/E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: tehart@me.com
  Subject: Re: Newbie Question-Quoting SQL
  In-Reply-To: <E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com>
  References: <E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox