プログラム | 写真をアップロードする |
/******* 使用されるテーブル構造********
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) ' 1',
news_show char(1) DEFAULT '1',
主キー (news_id),
KEY id (news_id)
);
DROP TABLE IF EXISTS pic;
CREATE TABLE pic (
id int(11) NOT NULL auto_increment,
画像 blob NOT NULL,
picture_type varchar(50) NOT NULL,
主キー (id),
一意の 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 = まつげを追加します(fread($fp=fopen($picture,"r"), filesize ($picture)));
$i_str="画像 (picture,picture_type) の値 ('$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 "已添加!";
}
< /html>