<?php 
$db=$GLOBALS['db'];
$number=1001;
$query="select id from accounts where deleted=0";
$zap=$db->query($query);
while($dane=$db->fetchByAssoc($zap)){
		$a = new Account();
		$a->retrieve($dane['id']);
		$a->ks_account=$number;
		$a->save();
		$number++;
}
?>