title>SOBI2</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
</head>
<body>
<?php
$connect = mysql_connect( 'localhost', 'username', 'password') or die('Could not connect to mysql server.');
mysql_select_db('dbname', $connect) or die('Could not select database.');
$result = mysql_query('SELECT `itemid`, `title`, `metakey` FROM `jos_sobi2_item` WHERE `itemid` > 0');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while (($row = mysql_fetch_assoc($result))!==false) {
$itemid = $row['itemid'];
$title = $row['title'];
$update_qry = mysql_query('UPDATE `jos_sobi2_item` SET `metakey` = "'.$title.'" WHERE `itemid` = "'.$itemid.'"');
}
if ($row == false) echo 'Success!';
mysql_close();
?>
</body>
</html>Add a code snippet to your website: www.paste.org