I need a bit of help with an error I am receiving with VB.
The action I am trying to take, is to update parts of my forum through the maintenance section in the Admin CP.
However, it appears that all is well except for when it comes to updating the usernames. I get an database error.
I have checked the Misc.php script and I cannot work out if there is something not right in the script.
Can someone who has more knowledge than myself provide some info and/or solution. Thanks.
The error message:
The Update usernames bit from the misc.php:
I am using GYSN rel of VB 3.7.4 if that helps.
TIA Jonty.
The action I am trying to take, is to update parts of my forum through the maintenance section in the Admin CP.
However, it appears that all is well except for when it comes to updating the usernames. I get an database error.
I have checked the Misc.php script and I cannot work out if there is something not right in the script.
Can someone who has more knowledge than myself provide some info and/or solution. Thanks.
The error message:
Code:
Invalid SQL:
UPDATE;
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error Number : 1064
Request Date : Wednesday, November 19th 2008 @ 03:36:18 AM
Error Date : Wednesday, November 19th 2008 @ 03:36:19 AM
Script : http://www.mysite.com/site/admincp/misc.php?do=updateusernames
Referrer : http://www.mysite.com/site/admincp/misc.php?do=chooser
IP Address : My Ip Address
Username : My username
Classname : vB_Database
MySQL Version : 5.0.67-log
PHP:
// ###################### Start update usernames #######################
if ($_REQUEST['do'] == 'updateusernames')
{
if (empty($vbulletin->GPC['perpage']))
{
$vbulletin->GPC['perpage'] = 1000;
}
echo '<p>' . $vbphrase['updating_usernames'] . '</p>';
$users = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE userid >= " . $vbulletin->GPC['startat'] . "
ORDER BY userid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while ($user = $db->fetch_array($users))
{
$userman =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userman->set_existing($user);
$userman->update_username($user['userid'], $user['username']);
unset($userman);
echo construct_phrase($vbphrase['processing_x'], $user['userid']) . "<br />\n";
vbflush();
$finishat = ($user['userid'] > $finishat ? $user['userid'] : $finishat);
}
$finishat++; // move past the last processed user
if ($checkmore = $db->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE userid >= $finishat LIMIT 1"))
{
print_cp_redirect("misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updateusernames&startat=$finishat&pp=" . $vbulletin->GPC['perpage']);
echo "<p><a href=\"misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updateusernames&startat=$finishat&pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";
}
else
{
define('CP_REDIRECT', 'misc.php');
print_stop_message('updated_usernames_successfully');
}
}
TIA Jonty.