/*******所用到的表结构********
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 "已添加!";
}