Wordpress rebuild broken permalinks

No way (programs, plugins) to fix links automatically, use script like the following:

1
2
3
4
5
6
7
8
9
10
11
12
<?
$blog_url=’http://localhost/jehy.ru/articles/’;
$prefix=’wp_’;

$sql=’SELECT `id`,`post_name` FROM `’.$prefix.’posts`’;
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
$sql2=‘UPDATE `’.$prefix.‘`posts` SET `guid`=”‘.$blog_url.‘archives/’.$row['id'].‘/’.$row['post_name'].‘” where id=”‘.$row['id'].‘”‘;
mysql_query($sql2);
}
?>