本帖最后由 winver 于 2009-5-6 13:23 编辑 if($_POST['sub']){ 
$message = get_ubb($_POST[message]);
$title = get_ubb($_POST[title]);
$http = get_ubb($_POST[http]);
$news = get_ubb($_POST[news]);$sql = "insert into db_news(news_name,news_content,news_pubtime,shoetype,http,yesno) values('$title','$message',now(),'$news','$http',1)";  
mysql_query('set names utf8'); //加这这句后就不执行 插入$result = mysql_query($sql); 
if($result){
//不会到这里来
  echo("<script type='text/javascript'> alert('发布成功!');location.href='infomation_news.php';</script>");
}} 

解决方案 »

  1.   

    建议将内容排版一下再发上来。加上一个@符号试试  @mysql_query
      

  2.   

    if($result)
    {
    //不会到这里来
      echo(" <script type='text/javascript'> alert('发布成功!');location.href='infomation_news.php'; </script>");

    else
    {
        exit( $sql );
    }
      

  3.   

    if($_POST['sub']){
    $message = get_ubb($_POST[message]);
    $title = get_ubb($_POST[title]);
    $http = get_ubb($_POST[http]);
    $news = get_ubb($_POST[news]);
    $sql = "insert into db_news(news_name,news_content,news_pubtime,shoetype,http,yesno) values('$title','$message',now(),'$news','$http',1)";
    @mysql_query('set names utf8');
    $result = mysql_query($sql);
    if($result){
    echo("<script type='text/javascript'> alert('发布成功!');location.href='infomation_news.php';</script>");
    }else {
    echo ($sql);  //会执行到这里来。
    }原因是加了,]@mysql_query('set names utf8');这句放,因为插入到mysql中是乱码,所以才加上的。 如果去掉的话,可以成功的执行!!