我收到错误消息“0行已受影响。 警告:#1265当我将html保存到Mysql数据库时,第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>
答案 0 :(得分:6)
这是因为您插入的值的长度大于列上定义的长度。增加色谱柱的长度。
答案 1 :(得分: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.
答案 2 :(得分: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 ;