<?php

/* b2 post renumbering */

# save and upload in your b2 directory, then load it from your browser
# since it is very basic, you might have to run it several times to have the correct numbering

include("b2config.php");

$connexion mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database server. MySQL said:<br />".mysql_error());
$connexionbase mysql_select_db("$base") or die("Can't connect to the database $base. MySQL said:<br />".mysql_error());

$sql "SELECT ID FROM $tableposts ORDER BY post_date ASC";
$result mysql_query($sql);

$i 1;
while(
$row mysql_fetch_object($result)) {
    
$id $row->ID;
    
$sql2 "UPDATE $tableposts SET ID = '$i' WHERE ID = '$id'";
    
$result2 mysql_query($sql2);
    echo 
"Post #$id -> #$i <br />";
    
$i++;
    
flush();
}

?>