List:General Discussion« Previous MessageNext Message »
From:John Trammell Date:September 11 2005 9:51pm
Subject:RE: HTML in MySQL?
View as plain text  
$input = "This is <br> the \n input";    # value from user
$saved = "This is <br> the <br> input";  # value in database
$recovered = "This is \n the \n input";  # retrieved from db, != $input

-----Original Message-----
From: Vladimir B. Tsarkov [mailto:bvbn@stripped]
Sent: Sun 9/11/2005 2:15 PM
To: mysql@stripped
Cc: mysql@lists.mysql.com
Subject: Re: HTML in MySQL?
 
Hello!

> But once you have done that, you can never recover the origional text.
> Try it on this email if you doubt it.

Why? Why not to use regular expressions?

> Use addslashes($htmlCode) and execute query normally. 
> $slashedHtmlCode = addslashes($htmlCode);

The problem is not in the executing of a query.

After the execution of the script:

<?php
$string = "\n\n\n\n 1";
echo addslashes($string);
?>

we will get:

1

and no empty lines.

If you want to output the same data, that was written using a textarea field 
of a form, you should use the "<br>" tag.

-- 
Good Luck!
Vladimir

Please, avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=johnt@stripped


Thread
HTML in MySQL?clint lenard9 Sep
  • Re: HTML in MySQL?Jasper Bryant-Greene9 Sep
    • Re: HTML in MySQL?clint lenard9 Sep
      • Re: HTML in MySQL?Jasper Bryant-Greene9 Sep
        • Re: HTML in MySQL?clint lenard9 Sep
  • Re: HTML in MySQL?douglass_davis12 Sep
    • Re: HTML in MySQL?clint lenard12 Sep
      • Re: HTML in MySQL?clint lenard12 Sep
        • Re: HTML in MySQL?clint lenard12 Sep
          • Re: HTML in MySQL?Hassan Schroeder12 Sep
RE: HTML in MySQL?SST - Adelaide)9 Sep
Re: HTML in MySQL?Unknown Sender9 Sep
Re: HTML in MySQL?Unknown Sender9 Sep
RE: HTML in MySQL?Alan Williamson9 Sep
  • Re: HTML in MySQL?Unknown Sender9 Sep
    • Re: HTML in MySQL?gerald_clark9 Sep
    • Re: HTML in MySQL?Filipe Tomita9 Sep
  • Re: HTML in MySQL?Unknown Sender9 Sep
RE: HTML in MySQL?John Trammell9 Sep
Re: HTML in MySQL?Unknown Sender11 Sep
  • Re: HTML in MySQL?Roger Baklund11 Sep
Re: HTML in MySQL?Unknown Sender11 Sep
RE: HTML in MySQL?John Trammell11 Sep
  • Re: HTML in MySQL?Jasper Bryant-Greene12 Sep
    • Re: HTML in MySQL?Jasper Bryant-Greene12 Sep
      • Re: HTML in MySQL?clint lenard12 Sep