! PHP mysql Insert long string does not insert related issues

Source: Internet
Author: User
Tags mysql insert php mysql
Help! PHP mysql Insert long string does not insert the problem.
The statement is this:
$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 inserting several pages of characters when inserting more than 10 pages of documents copied from Word that cannot be inserted.

Help me!


Share to:


------Solution--------------------
1, you directly use $_request data, it may be because the special characters are not escaped and cause insert failure
2, you may use the Text Type field, then the upper limit is 64k. More text is more likely to be overrun.
------Solution--------------------
$db->query ($sql);
Echo Mysql_error (); Post an error message
------Solution--------------------
Any data that is inserted into MySQL from PHP is preferable to escape processing.
$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.