Jump to content

[SOLVED] Data Migration - Splitting into Blocks


tsilver10

Recommended Posts

I have a phpBB database which I am trying to convert to work with Joomla. I'm using a script someone has provided and it works fine...apart from one section - the message text.

 

It doesn't give me an error or anything so I can only assume it is timing out.

 

What I would like to do is split the query/migration of the message text into blocks.

 

Here is the what is doing at the moment:

 

//Populate Messages_Text Table
echo "<br />Populating Messages_Text Table...\n";

$query="TRUNCATE TABLE `$joomla_db`.`{$joomla_dbprefix}fb_messages_text`";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="SELECT post_id, post_text FROM `$phpbb_db`.`{$phpbb_dbprefix}posts`";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());  
$mtext = array();
$mpostid = array();
while ($row = mysql_fetch_object($result)) { 
  $text = addslashes($row->post_text);
  $mtext[] = prep($text);
  $mpostid[] = $row->post_id;
} 
mysql_free_result($result); 

for ($i=0; $i < count($mtext); $i++){
  $query="INSERT INTO `$joomla_db`.`{$joomla_dbprefix}fb_messages_text`"
    ." (mesid, message) VALUES"
    ." (".$mpostid[$i].", \"".$mtext[$i]."\")";
  $result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
}

echo "OK\n";

 

Does anyone have any tips for me to split this up?

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.