-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_tags.php
More file actions
34 lines (25 loc) · 812 Bytes
/
update_tags.php
File metadata and controls
34 lines (25 loc) · 812 Bytes
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
<?php
include_once ('classes/Database.php');
include_once ('user/local.php');
# database options
$db = Database::getDB();
$mysqli = $db->getCon();
# line endings
if (php_sapi_name() == 'cli') {
$line_end = "\n";
} else {
$line_end = '<br>' . "\n";
}
# rename tag fields
$sql = 'ALTER TABLE `tags`
CHANGE `ID` `id` SMALLINT( 6 ) NOT NULL AUTO_INCREMENT ,
CHANGE `news_id` `article_id` SMALLINT( 6 ) NOT NULL ,
CHANGE `tag` `tag` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;';
$result = $mysqli->multi_query($sql);
if (!$result) {
echo '<pre>'; print_r($mysqli); echo '</pre>';
echo 'could not change fields in table tags' . $line_end;
} else {
echo 'changed fields in table tags' . $line_end;
}
?>