! Phpmysqlinsert long strings cannot be inserted

Source: Internet
Author: User
Tags mysql insert
Help! Phpmysqlinsert long strings cannot be inserted. the statement is as follows: $ SQL & nbsp ;=& nbsp; "INSERT & nbsp; INTO & nbsp; '{$ table-& gt; column_list_page}' & nbsp; set & nbsp; nI help! Php mysql insert long strings cannot be inserted.
The statement is as follows:
$ SQL = "INSERT INTO '{$ table-> column_list_page}' set nID = '{$ _ REQUEST ['nodeid']}', title = '{$ _ REQUEST ['title']}', Author = '{$ _ REQUEST ['author']}', content = '{$ _ REQUEST ['content']}', Note = '{$ _ REQUEST ['note']}', editor = '{$ _ SESSION ['adminuserinfo'] ['auserid']}', time = '". time (). "'";

$ Db-> query ($ SQL );}

There is no problem with inserting several page characters. when you insert a document that has more than 10 pages copied from word, it cannot be inserted.

For help!


Share To: column_list_page }'? Set? NID = '{$ _ REQUEST ['nodeid']}'... 'data-pics = ''>
------ Solution --------------------
1. if you directly use the $ _ REQUEST data, insertion may fail because the special characters are not converted or are not converted.
2. you may use text fields. The maximum value is 64 k. When there is more text, the limit may be exceeded.
------ Solution --------------------
$ Db-> query ($ SQL );
Echo mysql_error (); // post the error message
------ Solution --------------------
It is best to escape any data inserted from php to mysql.
$ Str = isset ($ _ REQUEST ['str'])? Addslashes ($ _ REQUEST ['str']): '';

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.