Re: INSERT INTO

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Bart Degryse <Bart(dot)Degryse(at)indicator(dot)be>
Cc: pgsql-sql(at)postgresql(dot)org, Shavonne Marietta Wijesinghe <shavonne(dot)marietta(at)studioform(dot)it>
Subject: Re: INSERT INTO
Date: 2007-03-16 09:16:58
Message-ID: 45FA608A.6060807@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Bart Degryse a ecrit le 16/03/2007 10:03:
> I don't use ASP but in PHP I would do something in the line of
>
> $valuetoinsert = "SANT'ANGELO LODIGIANO";
> $query = "INSERT INTO TABLE2 (TE_INDI) VALUES ('" . str_replace("'",
> "''", $valuetoinsert) . "')";
>
> I'm sure ASP has also a string replacement function
>

This doesn't answer Shavonne's question but, instead of str_replace, you
should better use pg_escape_string :
http://www.php.net/manual/en/function.pg-escape-string.php

Regards.

--
Guillaume.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Shavonne Marietta Wijesinghe 2007-03-16 09:26:53 Fw: INSERT INTO
Previous Message Bart Degryse 2007-03-16 09:03:15 Re: INSERT INTO