mysql好象把空格后的字符都过滤掉了?

解决方案 »

  1.   

    <?php
                   include '../dbConnection.php';
                   $TRecord = mysql_query("SELECT * FROM news_purpose_table");
                   $result = mysql_query("SELECT * FROM news_purpose_table ORDER BY  newsDate DESC LIMIT $StartRow,$PageSize");
                   //获取的总记录数                 
       $RecordCount = mysql_num_rows($TRecord);              //获取的总页数              
      $MaxPage = $RecordCount % $PageSize;
                 if($RecordCount % $PageSize == 0){
                          $MaxPage = $RecordCount / $PageSize;
                  }else{
                         $MaxPage = ceil($RecordCount / $PageSize);
                  }         
                  
                while($rows=mysql_fetch_array($result))               
                      {                             
                         $time=substr($rows[newsDate],0,10);
                         echo "<table border=0 width=100%><tr><td width=3%><img src=./photo/logo.jpg></td><td width=82% align=left><a href=\"xinwen1.php?id=".$rows["id"] ."\" target=\"_blank\">". $rows["title"]."</a></td>";
                         echo "<td width=15% align=right valign=middle><font color=#aaaaaa>".$time."</font></td></tr></table>";
                            // echo "<tr><td colspan=2 height=1><img src=./photo_1/line.gif></td></tr></table>";  
        
                      }          
        
     ?>
    这是显示代码?
    这是编辑代码?
    <?php 
          include "../dbConnection.php";
          $id=$_GET[id];
           //echo $id;
          $mysql="select * from news_purpose_table where id='$id'";
          $result=mysql_query($mysql) or die(mysql_error());
          while($rows=mysql_fetch_array($result))
            {    $news_sort=$rows[newsort];
       echo "<form name=form1 method=post action=save_news.php align=left>";
                     echo "<table border=1 cellspacing=0 cellpadding=0 >";
                          echo "<tr><td colspan=2>查看新闻</td></tr>";
                          echo "<tr><td align=right>新闻种类:</td>";
      echo "<td align=left><select name=newsort>";
      $sort_mysql="select * from news_sort_table";
      $sort_result=mysql_query($sort_mysql) or die(mysql_error());
      while($sort_row=mysql_fetch_array($sort_result))
    {    
         $sort=$sort_row[newsort];
     if(strcmp($news_sort,$sort)==0)
       {
                                         echo "<option selected>".$sort."</option>";
       }else {
        echo "<option>".$sort."</option>";
       }
       
      }
      echo "</select>";
                  echo "</td></tr>";
                  echo "<tr><td align=right>标题:</td>";
                      echo "<td align=left><input type=text name=title size=60 value=".$rows[title]."></td>";
                  echo "</tr>";
                  echo "<tr><td align=right>具体内容:</td>";
                      echo "<td align=left><textarea rows=15 cols=60 name=content> $rows[content] </textarea></td>";
                  echo "</tr>";
                    echo "<tr>";
                         echo "<td align=right> 发布时间:</td>";
                         echo "<td align=left><input type=text name=time value=$rows[newsDate]></td></tr>";
                  echo "<tr><td colspan=2 align=center><input type=hidden name=id value=".$id."><input type=submit name=submit value=保存>&nbsp;&gt;&gt;<a href=delete_news.php?id=$id> 删除 </a> </td></tr>";
               echo "</table>";
           echo "</form>";
         }
      mysql_close();
      exit;
    ?>
    就是在编辑的时候,标题没有显示全
      

  2.   

    猜到了value后面的值要用""做边界
      

  3.   

    echo "<td align=left><input type=text name=title size=60 value='".$rows[title]."'></td>";
      

  4.   

    可不可以在说清楚点,我有点 不明白,你是说value 后面的$rows[title]用用""吗?