Skip site navigation (1) Skip section navigation (2)

Newbie Question-Quoting SQL

From: Thomas Hart <tehart(at)me(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Newbie Question-Quoting SQL
Date: 2009-04-27 19:56:23
Message-ID: E4ACCD5E-1A3B-4A3B-B2ED-6AF0C74222FE@me.com (view raw or flat)
Thread:
Lists: pgsql-php
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

Responses

pgsql-php by date

Next:From: Leif B. KristensenDate: 2009-04-27 20:02:19
Subject: Re: Newbie Question-Quoting SQL
Previous:From: Jasen BettsDate: 2009-04-19 12:20:03
Subject: Re: sorting query results

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group