pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David C. Brown <dbrown@centennialwines.com>
To: Clio <clio@zgia.zp.ua>
Cc: pgsql-php@postgresql.org
Subject: Re: parsing html in pgsql using php
Date: Thu, 22 Aug 2002 09:06:27 -0500
Message-ID: <3D64EFE3.1060804@centennialwines.com> (raw)
References: <20020822135952.GD76528@zgia.zp.ua>

You need to escape your apostrophes.  Your query statment uses 
apostrophes and you have them in the string that your inserting into the db.

I believe you can use addslashes() and stripslashes() to help you with this.

http://www.php.net/manual/en/function.addslashes.php

Dave

Clio wrote:

>Subject ... how to?
>
>here is an example:
>
><?php
>
>
>$tmp = "
>
><table width='175' cellSpacing='0' cellPadding='0' border='0' align='right'><tr>
> <td align='center' vAlign='middle' style=\"border: 1px solid black; background-color: #f0f0f0;\">
>  Sample text in table.
> </td>
></tr></table>
>
>";
>
>pg_connect("host=localhost dbname=daatabase user=web_user password=password");
>
>pg_query("insert into site_common values ('01','00','".$tmp."')");
>
>
>?>
>
>
>Here is an error:
>
>
>Warning: pg_query() query failed: ERROR: parser: parse error at or near "175" in /w/devel/test/dbinsert.php on line 80
>
>
>Any ideas?
>
>
>/ Clio
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>  
>





view thread (4+ messages)  latest in thread

Message-ID: <3D64EFE3.1060804@centennialwines.com>
Permalink:  ../3D64EFE3.1060804@centennialwines.com/
Also on:    postgresql.org/message-id/3D64EFE3.1060804@centennialwines.com

 · 

reply

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: dbrown@centennialwines.com, clio@zgia.zp.ua
  Subject: Re: parsing html in pgsql using php
  In-Reply-To: <3D64EFE3.1060804@centennialwines.com>
  References: <20020822135952.GD76528@zgia.zp.ua> <3D64EFE3.1060804@centennialwines.com>

* 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