sql_2_topic.php
来自「jforum->smf database migration」· PHP 代码 · 共 70 行
PHP
70 行
<?php
$dbname="smf";
$dbhost="localhost";
$dbuser="root";
$dbpass="";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
mysql_query("TRUNCATE TABLE `smf_topics`;");
$i=1;
while($i<2321){
$i=$i+1;
$sql = "SELECT * FROM jforum_topics WHERE topic_id = $i";
$result = mysql_query($sql);
$variable = mysql_fetch_array($result);
$id_topic = $variable["topic_id"];
$id_board = $variable["forum_id"];
$id_first_msg = $variable["topic_first_post_id"];
$id_last_msg = $variable["topic_last_post_id"];
$id_member_started = $variable["user_id"];
$numreplies = $variable["topic_replies"];
$numviews = $variable["topic_views"];
#--------------------------------
$sticky =$variable["topic_type"];
if($sticky==2)$sticky=1;
$locked =$variable["topic_status"];
#-------------------------------
$sql2 = "INSERT INTO `smf_topics` (`ID_TOPIC`, `isSticky`, `ID_BOARD`, `ID_FIRST_MSG`, `ID_LAST_MSG`, `ID_MEMBER_STARTED`, `ID_MEMBER_UPDATED`, `ID_POLL`, `numReplies`, `numViews`, `locked`)
VALUES ('$id_topic', '$sticky', '$id_board', '$id_first_msg', '$id_last_msg', '$id_member_started', '$id_member_started', 0, '$numreplies', '$numviews', '$locked');";
$result2= mysql_query($sql2);
if (!$result2) {
echo $i.'--'.$id_member_started.'<br/>';
#die('Ung黮tige Abfrage: ' . mysql_error());
echo $sql2;
}
}
#mysql_query("DELETE FROM `smf_log_activity` WHERE date = '2006-09-15';");
#mysql_query("INSERT INTO `smf_log_activity` (`date`, `hits`, `topics`, `posts`, `registers`, `mostOn`) VALUES ('2006-09-15', 0, 0, 0, 0, 0)");
#mysql_query("UPDATE `smf_log_activity` SET topics = ( SELECT count( ID_TOPIC ) FROM smf_topics ) WHERE date ='2006-09-15';");
#mysql_query("UPDATE `smf_log_activity` SET posts = ( SELECT count( ID_MSG ) FROM smf_messages ) WHERE date ='2006-09-15';");
#mysql_query("UPDATE `smf_log_activity` SET registers = ( SELECT count( ID_MEMBER ) FROM smf_members ) WHERE date ='2006-09-15';");
mysql_close();
#INSERT INTO `smf_topics` (`ID_TOPIC`, `isSticky`, `ID_BOARD`, `ID_FIRST_MSG`, `ID_LAST_MSG`, `ID_MEMBER_STARTED`, `ID_MEMBER_UPDATED`, `ID_POLL`, `numReplies`, `numViews`, `locked`) VALUES ('2173', 0, '22', '102095', '0', '2532', '2532', 0, '0', '1', 0);
#INSERT INTO `smf_topics` (`ID_TOPIC`, `isSticky`, `ID_BOARD`, `ID_FIRST_MSG`, `ID_LAST_MSG`, `ID_MEMBER_STARTED`, `ID_MEMBER_UPDATED`, `ID_POLL`, `numReplies`, `numViews`, `locked`) VALUES ('2255', 0, '22', '106147', '0', '1767', '1767', 0, '0', '1', 0);
#
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?