0

当我将我的 html 保存到 Mysql 数据库时,我收到错误消息说“0 行受影响。警告:#1265 第 1 行的列‘内容’被截断”。

Html如下:

关于我们
    <p>We are revolutionising the way people shop around the world by providing the freedom to purchase from any website using your very own US or UK shipping address. We're used by both consumers and businesses to buy all sorts of products and merchandise from overseas. Have a look at what people are <a href="/pages/testimonials">saying</a> about us.</p>
    <h2 class="title" id="title"> We<span class="green"> Offer</span> </h2>
    <ul class="arr">
      <li>Great deals from all over the globe on a range of products from the hottest fashion to the latest technology.</li>
      <li>Shipping rates designed with the consumer in mind!</li>
      <li>Social Shipping- buy with friends and create one large package for Big Savings!</li>
      <li>A clever Total Cost Calculator that allows you to see the Total Cost to deliver your package to your door- duties and taxes included!</li>
    </ul>
    <h2 class="title" id="title"> So who are<span class="green"> We</span> </h2>
    <ul class="arr">
      <li><a href="/bx/enUS/pages/the-team">Check-out our team's profiles.</a></li>
    </ul>
    <h2 class="title" id="title"> Who uses <span class="green"> Store to Ship?</span> </h2>
    <p>Store to Ship is used by private consumers and businesses to buy all sorts of products and merchandise overseas. Have a look at what people are saying about us.</p>
4

3 回答 3

6

这是因为您插入的值的长度大于列上定义的长度。增加列的长度。

于 2013-09-24T06:56:28.903 回答
1

希望下面的解释对你有帮助

1. Use LONGTEXT/TEXT as type for the field in which you want to save html data
2.
   <?php
     $data = "HTML data";

     if(get_magic_quotes_gpc())
         $data = trim($data);
     else 
         $data = $mysqli->real_escape_string($data);
   ?>
3. then insert to this field.
于 2013-09-24T07:04:05.717 回答
0

用于Text DataType在其中存储您的 HTML 代码。

您的数据长度大于定义的长度。

CREATE TABLE IF NOT EXISTS menu ( id int(11) NOT NULL AUTO_INCREMENT, menu_name varchar(255) NOT NULL, menu_url varchar(255) NOT NULL, content TEXT() NOT NULL, image varchar(255) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
于 2013-09-24T07:01:49.777 回答