Lists: | pgsql-fr-generale |
---|
From: | BPascal <pascal62fr(at)free(dot)fr> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Problème d'insert |
Date: | 2008-10-16 12:20:43 |
Message-ID: | 48F7319B.3080506@free.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Bonjour,
Je fais un Insert sous PHP
Pour la valeur $nom="L'EPE", l'Insert ne ce fait pas.
Il dois bien y avoir une solution simple pour ce problème, mais je ne la
trouve pas.
Cordialement
--
Pascal
From: | Christophe Chauvet <christophe(at)kryskool(dot)org> |
---|---|
To: | BPascal <pascal62fr(at)free(dot)fr> |
Cc: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Re: Problème d'insert |
Date: | 2008-10-16 12:31:48 |
Message-ID: | 48F73434.6050908@kryskool.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Bonjour
Oui c'est normal puisqu'il faut échapper certain caractères
donc
$nom="L'EPE"
donne
$nom="L\'EPE"
vous pouvez utilisez la fonction pg_escape_string
http://fr3.php.net/manual/fr/function.pg-escape-string.php
Cordialement,
Christophe Chauvet.
BPascal a écrit :
> Bonjour,
>
> Je fais un Insert sous PHP
> Pour la valeur $nom="L'EPE", l'Insert ne ce fait pas.
>
> Il dois bien y avoir une solution simple pour ce problème, mais je ne la
> trouve pas.
>
> Cordialement
From: | BPascal <pascal62fr(at)free(dot)fr> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Re: Problème d'insert |
Date: | 2008-10-16 16:35:10 |
Message-ID: | 48F76D3E.4030205@free.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Christophe Chauvet a écrit :
> Bonjour
>
> Oui c'est normal puisqu'il faut échapper certain caractères
>
> vous pouvez utilisez la fonction pg_escape_string
> http://fr3.php.net/manual/fr/function.pg-escape-string.php
J'ai "oublié" de l'utiliser, merci, ça marche.
Avant d'entrée une donnée dans la base j'utilise:
htmlspecialchars( pg_escape_string($nom, ENT_COMPAT, "UTF-8"))
trim($nom)
pg_escape_string($nom)
et un test selon les cas
if (strlen($nom)==0)
Cordialement
--
Pascal