求助~~~~~

小弟照着书上做了一个新闻发布系统,服务器为Apache+Mysql+PHP+PhpMyAdmin,我做好后点添加按钮,却出现如下提示:Incorrect string value: '\xB9\xAB\xB8\xE6' for column 'news_type' at row 1,不知道是什么原因,请各位帮帮我~~~~~(以下是原码)



[复制到剪切板]
CODE:
<?php require_once('Connections/connNews.php'); ?>
<?
php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}
$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO newscenter (news_type, news_date, news_subject, news_content, news_editor) VALUES (%s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['news_type'], "text"),
                       
GetSQLValueString($_POST['news_date'], "date"),
                       
GetSQLValueString($_POST['news_subject'], "text"),
                       
GetSQLValueString($_POST['news_content'], "text"),
                       
GetSQLValueString($_POST['news_editor'], "text"));
  
mysql_select_db($database_connNews$connNews);
  
$Result1 mysql_query($insertSQL$connNews) or die(mysql_error());
  
$insertGoTo "newsAdmin.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?><!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<
title>:: 新闻发布系统 ::</title>
<
link href="style.css" rel="stylesheet" type="text/css" />
</
head>
<
body>
<
table border="0" cellpadding="0" cellspacing="0" width="640" align="center">
  <
tr>
    <
td><img src="images/newsCenter_r1_c1.jpg" alt="" name="newsCenter_r1_c1" width="640" height="10" border="0" id="newsCenter_r1_c1" /></td>
  </
tr>
  <
tr>
    <
td style="height: 60px"><table align="left" border="0" cellpadding="0" cellspacing="0" width="640">
      <
tr>
        <
td><img src="images/newsCenter_r2_c1.jpg" alt="" name="newsCenter_r2_c1" width="188" height="60" border="0" id="newsCenter_r2_c1" /></td>
        <
td width="452"><table align="left" border="0" cellpadding="0" cellspacing="0" width="452">
          <
tr>
            <
td width="452" height="45" background="images/newsCenter_r2_c2.jpg" align="right" valign="bottom" class="nav"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <
tr>
                <
td align="right"><img align="absmiddle" src="images/board_mark_list.gif" /> <a href="newsAdmin.php" class="nav">新闻管理</a></td>
                <
td width="8%"> </td>
              </
tr>
            </
table></td>
          </
tr>
          <
tr style="font-size: 12pt; color: #000000">
            <
td><img src="images/newsCenter_r3_c2.jpg" alt="" name="newsCenter_r3_c2" width="452" height="15" border="0" id="newsCenter_r3_c2" /></td>
          </
tr>
        </
table></td>
      </
tr>
    </
table></td>
  </
tr>
  <
tr style="font-size: 12pt; color: #000000">
    <
td background="images/newsCenter_r4_c1.jpg" align="center"><form method="POST" action="<?php echo $editFormAction; ?>" id="form1" name="form1">
      <
table cellpadding="4" cellspacing="1" border="0" width="90%" class="forumline">
        <
tr>
          <
th align="center" colspan="2"新闻内容</th>
        </
tr>
        <
tr>
          <
td align="right" width="127" class="row3"新闻标题:</td>
          <
td width="477" align="left" class="row1"><input name="news_subject" type="text" id="news_subject" /></td>
        </
tr>
        <
tr>
          <
td align="right" width="127" class="row3"新闻类别:</td>
          <
td align="left" class="row1"><select name="news_type" id="news_type">
            <
option value="公告" selected="selected">公告</option>
            <
option value="更新">更新</option>
            <
option value="活动">活动</option>
            <
option value="其他">其他</option>
          </
select>
          </
td>
        </
tr>
        <
tr>
          <
td align="right" width="127" class="row3"公告日期:</td>
          <
td align="left" class="row1"><input name="news_date" type="text" id="news_date" value="<?php echo date("Y-m-d H:i:s");?>" /></td>
        </
tr>
        <
tr>
          <
td align="right" width="127" class="row3"编辑者:</td>
          <
td align="left" class="row1"><input name="news_editor" type="text" id="news_editor" /></td>
        </
tr>
        <
tr>
          <
td width="127" align="right" valign="top" class="row3"内容:</td>
          <
td align="left" class="row1"><textarea name="news_content" cols="40" rows="5" id="news_content"></textarea></td>
        </
tr>
      </
table>
        <
hr width="90%" noshade="noshade" />
        <
label>
        <
input type="submit" name="Submit" value="添加资料" /> 
        </
label>
        <
input type="reset" name="Submit2" value="重设资料" />
        <
input type="hidden" name="MM_insert" value="form1">
    </
form>
    </
td>
  </
tr>
  <
tr style="font-size: 12pt; color: #000000">
    <
td><img src="images/newsCenter_r5_c1.jpg" alt="" name="newsCenter_r5_c1" width="640" height="25" border="0" id="newsCenter_r5_c1" /></td>
  </
tr>
</
table>
</
body>
</
html> ;



[ 本帖最后由 alanchencb 于 2007-12-11 09:58 编辑 ]