Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E32E247664D for ; Tue, 10 Sep 2002 12:30:09 -0400 (EDT) Received: from c000.lhr.cp.net (h016.c000.lhr.cp.net [209.228.22.166]) by postgresql.org (Postfix) with SMTP id E6EC9476675 for ; Tue, 10 Sep 2002 12:30:08 -0400 (EDT) Received: (cpmta 20393 invoked from network); 10 Sep 2002 16:30:00 +0000 Received: from 209.228.22.157 (HELO mail.20min.ch.criticalpath.net) by smtp.20min.ch (209.228.22.166) with SMTP; 10 Sep 2002 16:30:00 +0000 X-Sent: 10 Sep 2002 16:30:00 GMT Received: from [130.60.176.36] by mail.20min.ch with HTTP; Tue, 10 Sep 2002 16:30:05 0 (GMT) Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: pgsql-php@postgresql.org From: hellau@20min.ch Subject: submitting varchar string from form / escape characters X-Sent-From: hellau@20min.ch Date: Tue, 10 Sep 2002 16:30:05 0 (GMT) X-Mailer: Web Mail 5.0.11-9 Message-Id: <20020910163006.5672.h007.c000.wm@mail.20min.ch.criticalpath.net> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/25 X-Sequence-Number: 1480 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