ukscotth Posted July 19, 2009 Share Posted July 19, 2009 Hi, Im trying to transfer the data from my old forum to a new one which is different. For some reason when i transfer the posts it misses random posts. This is the code im using, can anyone see a problem with it ? <?php include("include/configvb.inc.php"); $topics = mysql_query("SELECT * FROM joovili_forum_posts WHERE post_board=3"); while ($got_users = mysql_fetch_array($topics)){ $fid = mysql_query("SELECT * FROM joovili_users WHERE username = '".$got_users['post_username']."' LIMIT 1"); if (mysql_num_rows($fid) == 0) { $i ='0'; } else { $fid1 = mysql_fetch_array($fid); $i = $fid1['id']; } $string = $got_users['post_date']; $timestamp = strtotime($string); mysql_query("INSERT INTO post ( `dateline`, `postid`, `threadid`, `username`, `userid`, `pagetext`, `allowsmilie`, `visible` ) VALUES ( '".$timestamp."', '".$got_users['post_id']."', '".$got_users['post_topic']."', '".$got_users['post_username']."', '".$i."', '".$got_users['post_body']."', '1', '1' )"); } ?> many thanks, scott. Quote Link to comment Share on other sites More sharing options...
ukscotth Posted July 19, 2009 Author Share Posted July 19, 2009 just had a play about and if i put this in phpmyadmin it manages to transfer all the posts but how do i put variables into this line of code so i can get the userid etc ? INSERT INTO post (postid, threadid, username, userid, pagetext, allowsmilie, visible) SELECT post_id, post_topic,post_username,30,post_body,1,1 FROM joovili_forum_posts Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.