-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent2.php
More file actions
58 lines (55 loc) · 3.13 KB
/
content2.php
File metadata and controls
58 lines (55 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
$con = mysql_connect('localhost','root','');
if(!$con){
die('could not connect:'.mysql_errno());
}
mysql_select_db('freshman',$con);
mysql_query("SET NAMES 'utf8'");
$name = "SELECT * FROM dc_newsinfo WHERE catid = 32";
$result = mysql_query($name);
while($row = mysql_fetch_object($result)){
$sam = mysql_query("INSERT INTO fm_posts (title,content,source,author_id,created_date,status)
VALUES('$row->title','$row->newscontent','$row->source','1','$row->addtime','1')");
$name1 = "SELECT `id` FROM fm_posts where title= '$row->title'";
$name2 = mysql_query($name1,$con);
$name3 = mysql_fetch_array($name2);
mysql_query("INSERT INTO fm_posts_categories(post_id,category_id) VALUES ($name3[0],'1')");
mysql_query("INSERT INTO fm_posts_tags(post_id,tag_id) VALUES ($name3[0],'1')");
$naem = mysql_query("INSERT INTO `fm_post_metas`(`post_id`,`key`,`value`) VALUES ($name3[0],'campus','大学城')");
}
$name = "SELECT * FROM dc_newsinfo WHERE catid = 34";
$result = mysql_query($name);
while($row = mysql_fetch_object($result)){
$sam = mysql_query("INSERT INTO fm_posts (title,content,source,author_id,created_date,status)
VALUES('$row->title','$row->newscontent','$row->source','1','$row->addtime','1')");
$name1 = "SELECT `id` FROM fm_posts where title= '$row->title'";
$name2 = mysql_query($name1,$con);
$name3 = mysql_fetch_array($name2);
mysql_query("INSERT INTO fm_posts_categories(post_id,category_id) VALUES ($name3[0],'2')");
mysql_query("INSERT INTO fm_posts_tags(post_id,tag_id) VALUES ($name3[0],'1')");
$naem = mysql_query("INSERT INTO `fm_post_metas`(`post_id`,`key`,`value`) VALUES ($name3[0],'campus','大学城')");
}
$name = "SELECT * FROM dc_newsinfo WHERE catid = 45";
$result = mysql_query($name);
while($row = mysql_fetch_object($result)){
$sam = mysql_query("INSERT INTO fm_posts (title,content,source,author_id,created_date,status)
VALUES('$row->title','$row->newscontent','$row->source','1','$row->addtime','1')");
$name1 = "SELECT `id` FROM fm_posts where title= '$row->title'";
$name2 = mysql_query($name1,$con);
$name3 = mysql_fetch_array($name2);
mysql_query("INSERT INTO fm_posts_categories(post_id,category_id) VALUES ($name3[0],'3')");
mysql_query("INSERT INTO fm_posts_tags(post_id,tag_id) VALUES ($name3[0],'1')");
$naem = mysql_query("INSERT INTO `fm_post_metas`(`post_id`,`key`,`value`) VALUES ($name3[0],'campus','大学城')");
}
$name = "SELECT * FROM dc_newsinfo WHERE catid = 36";
$result = mysql_query($name);
while($row = mysql_fetch_object($result)){
$sam = mysql_query("INSERT INTO fm_posts (title,content,source,author_id,created_date,status)
VALUES('$row->title','$row->newscontent','$row->source','1','$row->addtime','1')");
$name1 = "SELECT `id` FROM fm_posts where title= '$row->title'";
$name2 = mysql_query($name1,$con);
$name3 = mysql_fetch_array($name2);
mysql_query("INSERT INTO fm_posts_categories(post_id,category_id) VALUES ($name3[0],'4')");
mysql_query("INSERT INTO fm_posts_tags(post_id,tag_id) VALUES ($name3[0],'1')");
$naem = mysql_query("INSERT INTO `fm_post_metas`(`post_id`,`key`,`value`) VALUES ($name3[0],'campus','大学城')");
}