Home > Backend Development > PHP Tutorial > 这是我在做的一个系统中的新闻增加程序,可以上传图片,也可以输_PHP

这是我在做的一个系统中的新闻增加程序,可以上传图片,也可以输_PHP

WBOY
Release: 2016-06-01 12:36:25
Original
919 people have browsed it

/*******所用到的表结构********
DROP TABLE IF EXISTS index_news;
CREATE TABLE index_news (
   news_id bigint(20) NOT NULL auto_increment,
   news_date date DEFAULT '0000-00-00' NOT NULL,
   news_title varchar(100) NOT NULL,
   news_content text,
   news_link varchar(100),
   is_new char(1) DEFAULT '1',
   picture_id int(11),
   picture_side char(1) DEFAULT '1',
   news_show char(1) DEFAULT '1',
   PRIMARY KEY (news_id),
   KEY id (news_id)
);
DROP TABLE IF EXISTS picture;
CREATE TABLE picture (
   id int(11) NOT NULL auto_increment,
   picture blob NOT NULL,
   picture_type varchar(50) NOT NULL,
   PRIMARY KEY (id),
   UNIQUE id (id)
);
**********************/
require("../include/date.inc.php3");
require("../include/config.inc.php3");
?>




修改首页新闻信息




if ($add){
    $date=input2date($news_date);
    //echo $picture . "  ". filesize($picture);
    //if ($is_new!="0") $is_new="1" ;
    //if ($news_show!="0") $news_show="1";
    //if ($picture_side!="2") $picture_side="1";
    if ($picture!="none"){
        $pic_data = addslashes(fread($fp=fopen($picture,"r"), filesize($picture)));
        $i_str="insert into picture (picture,picture_type) values ('$pic_data','$picture_type')";
        //$rs->open($i_str);
        $result=mysql_query($i_str,$dbconnect);
        $picture_id=mysql_insert_id();
        fclose($fp);
        unlink($picture);
    }
    else{
        $picture_id=0 ;
    }
    $i_str="insert into index_news (news_date,news_title,news_content,news_link,picture_id,is_new,picture_side,news_show) values ";
    $i_str.="('$date','$news_title','$news_content','$news_link','$picture_id','$is_new','$picture_side','$news_show') ";

    if (mysql_query($i_str,$dbconnect)) echo "已添加!";

}


  
    
      
    
    
      
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
    
  

        
增加新闻信息

      
 
新闻标题:
        
      
新闻内容:
        
      
新闻日期:
        
        (日期请按照2000-01-02格式输入)
新闻链接:
        
      
是否最新:
        
      
新闻图片:
        
      
图片位置:
        
      
是否显示:
        
      

        

          
          
          
        

      

  


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template