From: hellau@20min.ch
To: pgsql-php@postgresql.org
Subject: submitting varchar string from form / escape characters
Date: Tue, 10 Sep 2002 16:30:05 0 (GMT)
Message-ID: <20020910163006.5672.h007.c000.wm@mail.20min.ch.criticalpath.net> (raw)
hi all,
I am using pgsql with php and have the following
problem:
I have a form which lets the user dynamically select a
table, after this query he gets a list of possible
attributes, after selecting one he can do a subquery
and select a second attribute, and an operator, and a
value. after this I put the final sql query string
together like:
$sql = "SELECT $attribute FROM $table WHERE $attribute2
$operator $value";
this string is now submitted to another php document
doing the query and tabing the results out. if $value
is a number, everything works fine, but if $value is a
string with several words, commatas and/or spaces
inside, I get an error message. when I try to do
something like "'".$value."'" I always get: ERROR:
parser: parse error at or near "\"
I tryed all possibilities of escape characters I could
think of. If somebody knows what I am missing, help
would be apreciated.
Tom
Get your free mail account @ http://www.20min.ch - Your Urban Update Tool
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: hellau@20min.ch
Subject: Re: submitting varchar string from form / escape characters
In-Reply-To: <20020910163006.5672.h007.c000.wm@mail.20min.ch.criticalpath.net>
References: <20020910163006.5672.h007.c000.wm@mail.20min.ch.criticalpath.net>
* 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