$sql="SELECT * FROM wiki_doc where did = '27' ";
$result = mysql_query($sql) or die("sql语句有误"); while($row = mysql_fetch_array($result)) {
$content = $row['content'];
} $content = "<DIV style="WIDTH: 200px" class="img img_l"><A title=中国农业银行 href="uploads/201003/1267756208swWDR6Mo.jpg" target=_blank><IMG title=中国农业银行 alt=中国农业银行 src="uploads/201003/1267756208swWDR6Mo_s.jpg"></A><strong>中国农业银行</strong></DIV><P>中国农业银行是五大国有商业银行之一,在中国五大银行中排位第二。也是新中国设立的第一家商业银行,也是改革开放后第一家恢复成立的国家专业银行。</P>";上面是我从数据库得到的内容,echo $content能够在浏览器显示图片与文字。但是$newcontent = $content.$content;
$sql="UPDATE wiki_doc SET content='$newcontent' WHERE did= '27' ";
$result = mysql_query($sql) or die("sql语句有误"); 这样显示的是"sql语句有误",为什么update不行啊,求高手帮忙看看······
mysql_query("set names 'utf-8'")
看看.
mysql_query($sql) or die(mysql_error());//这样可以明确的知道sql错误
$sql="UPDATE wiki_doc SET content='".$newcontent."' WHERE did= '27' ";
$result = mysql_query($sql) or die("sql语句有误");
换成
$result = mysql_query($sql) or die(mysql_error());看是什么错
//look the explainwhile($row = mysql_fetch_array($result)) {
$content = $row['content']; //this is a array.
}//the anothor is a string .
$content = " <DIV style="WIDTH: 200px" class="img img_l"> <A title=中国农业银行 href="uploads/201003/1267756208swWDR6Mo.jpg" target=_blank> <IMG title=中国农业银行 alt=中国农业银行 src="uploads/201003/1267756208swWDR6Mo_s.jpg"> </A> <strong>中国农业银行 </strong> </DIV> <P>中国农业银行是五大国有商业银行之一,在中国五大银行中排位第二。也是新中国设立的第一家商业银行,也是改革开放后第一家恢复成立的国家专业银行。 </P>";上面是我从数据库得到的内容,echo $content能够在浏览器显示图片与文字。但是$newcontent = $content.$content; //look here, what the mean do you want ?
$sql="UPDATE wiki_doc SET content='$newcontent' WHERE did= '27' ";//echo $sql;
//please show the sql and check it that is right, then go on ...
$result = mysql_query($sql) or die("sql语句有误");