How can I save the text control format into MySQL

Source: Internet
Author: User
How can I save the text control format to MySQL without using the editor plugin?
To save the following TextBox1.Text content into MySQL: ' Saved format '. \ n "." Control symbol '
When it's saved in MySQL, it reads: ' Saved format. ' \ n ". Control symbol '
An integer string. The middle of the line break "\ n" is not valid, how can "\ n" in MySQL saved after the read with PHP and the effect of a newline?


Reply to discussion (solution)

generally use \ r \ n to express the line, you try, have not tried

But when we get to MySQL, it's not a newline, it's a variable string.

How to read and insert? Stick to the key code.

It's a very simple operation.

Call Echo (Main_shopactive ());


Read function main_shopactive () {$conn = Mysql_connect_conn (); $sql = "SELECT * from wx_active ORDER BY id desc limit 0,1"; $rs = mysql_db ($sql, $conn) or Die (' query record failed! '); if (mysql_num_rows ($rs) > 0) {while ($row = Mysql_fetch_assoc ($rs)) {$my _active = $row [' concent '];}} else{$my _active = ' NO active ';} return $my _active;} Insert Function new_shopactive ($content _text) {$conn = Mysql_connect_conn (); $sql = "INSERT into wx_active (concent) VALUES ( ' $content _text ') "; mysql_db ($sql, $conn); Mysql_close ($conn); return;}

You can see the line under the command line, the page to see the source to see.

This is the case now.
http://www.asnewmart.com/test.php

This is the case now.
http://www.asnewmart.com/test.php

I know what you mean.

Try this: $str= htmlspecialchars before deposit ($STR);
Read the output nl2br ($STR);

Not sure whether the first step requires a second step is the key

I'll write a demo later, you can try it first.

Enter and return to this page to refresh a bit.

\ n is the text line, to see the source code to see.
To display line breaks on an HTML page, it's good to use the NL2BR () function.

Does XML go become text?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.