>> " . $sql[$i];
$result = $db->sql_query($sql[$i]);
if( !$result )
{
$errored = true;
$error = $db->sql_error();
echo " :: FAILED ( " . $error['message'] . " )
\n\n";
}
else
{
echo " :: COMPLETED
\n\n";
}
}
if( $errored )
{
echo "\n
Errors occured! Please check and correct issues as required
\n";
}
else
{
$sql = "SELECT post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id ASC
ORDER BY post_id ASC";
if( !($result = $db->sql_query($sql)) )
{
die("Couldn't obtain first post id list");
}
if( $row = $db->sql_fetchrow($result) )
{
do
{
$post_id = $row['post_id'];
$topic_id = $row['topic_id'];
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = $post_id
WHERE topic_id = $topic_id";
if( !$db->sql_query($sql) )
{
die("Couldn't update topic first post id in topic :: $topic_id");
}
}
while ( $row = $db->sql_fetchrow($result) );
}
echo "\n
\nCOMPLETE! Please delete this file before continuing!
\n";
}
?>