Re: parsing html in pgsql using php

From: hodges(at)xprt(dot)net
To: pgsql-php(at)postgresql(dot)org
Subject: Re: parsing html in pgsql using php
Date: 2002-08-23 00:36:06
Message-ID: 3D652106.17202.396780@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Another way to do this is with a "here doc" block:
$sample = <<< HERE
quote marks in here don't need to be escaped.
it will look just like plain html code.
also good for queries
HERE;
print ("$sample");

Tom

On 22 Aug 2002 at 9:06, David C. Brown wrote:

> 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(at)postgresql(dot)org)
> >
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

In response to

Browse pgsql-php by date

  From Date Subject
Next Message angelo.rigo 2002-08-23 14:34:54 next and previous links
Previous Message Simeo Reig 2002-08-22 19:58:07 Re: Nextval Problems