PHP submits data to MySQL with data errors

Source: Internet
Author: User
$sql = "INSERT into Ecs_goods (Cat_id,goods_sn,goods_name,goods_name_style,goods_number,market_price,shop_price, Warn_number,goods_desc,is_real,is_on_sale,is_alone_sale,add_time,sort_order,is_new,give_integral,rank_integral , Goods_type) VALUES (' ". $goods _type." ', ' ". $goods _sn." ', ' ". $goods _name." ', "." ' + ' ".", 9999, ". $shop _price.", ". $shop _price.", 1,\ ". $str 2." \ ", 1,1,1, '". Time (). "', 100,0,-1,-1,". $goods _type_type. ")";


$str 2 characters in this variable about 2W or so, when the other data is normal, but this variable submitted only the data on the front of a small paragraph, but it is strange that I in the phpmyadmin with the same SQL to carry out the variables in the execution, but can execute success, to solve.


Reply to discussion (solution)

Database field length is not limited

If there is a limit, what should be modified?

Database field length is not limited


If there is a limit, what should be modified?

What is SQL executed by phpMyAdmin?
Also, what type of field are you in?

What is SQL executed by phpMyAdmin?
Also, what type of field are you in?


Text of
The SQL that phpMyAdmin executes is the one I output with echo $sql and then I submit it.

Create a stored procedure, a one-time insertion of 2W characters of data, so that PHP love Ah!

Too perverted! ~@~~~

Wait

A field 2W word, didn't get it, unclear so.

It is best to post MySQL error for analysis.
mysql_query ($sql) or Die (Mysql_error ());

Didn't get that big field, unknown.

Modify the MySQL configuration file (my.ini) in max_allowed_packet = 8M, try

Is the code not set?

Solve it yourself. Modify the data storage format just fine.

  • 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.