Re: Re: Storing HTML in a DB field...
| From: | Jonathan Villa | Date: | Tue, 29 Apr 2003 11:57:19 +0000 |
| Subject: | Re: Re: Storing HTML in a DB field... | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27430@lists.php.net to get a copy of this message | ||
I used str_replace() ;).
On Mon, 2003-04-28 at 22:57, Becoming Digital wrote:
> > My fix was to replace all single quotes in my html with the proper HTML
> > special character code..
>
> I hope you didn't do that by hand! You could have used addslashes() with
> htmlspecialchars() to do the task for you.
>
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
>
>
> ----- Original Message -----
> From: "Jonathan Villa" <jvilla@isdesigndev.com>
> To: "David Robley" <robleyd@ozemail.com.au>
> Cc: <php-db@lists.php.net>
> Sent: Monday, 28 April 2003 20:47
> Subject: Re: [PHP-DB] Re: Storing HTML in a DB field...
>
>
> It's my habit of echoing my query when there is a result, but in this
> situation, since my query includes HTML, it displays the HTML. So, what
> I do is view source in the browser and copy the text.
>
> My fix was to replace all single quotes in my html with the proper HTML
> special character code..
>
> Thanks for the reply
>
> On Mon, 2003-04-28 at 18:53, David Robley wrote:
> > In article <004c01c30dc8$c7d59730$2900a8c0@homegroup>,
> > jvilla@isdesigndev.com says...
> > > I know I have seen this before, but can't remember and am hard pressed
> > > for time.
> > >
> > > I have an app which wrote a bunch of HTML (tables, style definitions,
> > > etc) to a file and then it was displayed later. Well now, instead of
> > > saving it to a file, I want to store it in MySQL. It keeps failing. Do
> > > I need to do anything special before I insert it?
> > >
> > > Right now, my query looks like this:
> > >
> > > $sql = "INSERT INTO orders SET user_id =
> > > ".$_POST['user_id'].", order =
> > > '".$WRITE_TO_FILE."'";
> > >
> > > Where WRITE_TO_FILE is a var which has all the data via
> > >
> > > $WRITE_TO_FILE .= "blah blah";
> > > $WRITE_TO_FILE .= "blah blah";
> > > $WRITE_TO_FILE .= "blah blah";
> > > $WRITE_TO_FILE .= "blah blah";
> >
> > You might find it helpful to use mysql_error() after your insert to see if
> > the database returns a useful error message. Also, try echoing your
> > completed query to see if you can spot a syntax error.
> >
> >
> > --
> > Quod subigo farinam
> >
> > $email =~ s/oz$/au/o;
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>