Jump to content

transferring data from one forum to another


ukscotth

Recommended Posts

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.