I had the opposite problem. I had missing userfield entries that needed to be added and it was messing up the admin "search for user" form. I would get no results when searching for a member who didn't have a userfield entry. I made a couple small changes to your script and it worked great. Thanks
PHP Code:
<?php
$link = mysql_connect("servername", "dbusername", "dbpassword");
mysql_select_db("dbname");
set_time_limit(300000000);
$foundresult = mysql_query("select * from user order by userid asc");
$foundnum = mysql_num_rows($foundresult);
echo("Adding missing UserID entries to userfield...<br>\r\n");
for ($i=0;$i<$foundnum;$i++)
{
$row = mysql_fetch_array($foundresult);
$huntId = $row["userid"];
// now lookup user
$huntresult = mysql_query("select * from userfield where userid='$huntId'");
$huntnum = mysql_num_rows($huntresult);
if ($huntnum == 0)
{
echo("Adding: $huntId<br>\r\n");
mysql_query("INSERT INTO userfield (userid) VALUES ($huntId)");
}
}
echo("Finshed<br>\r\n");
mysql_close();
?>
it checks the user table and then looks for a userfield entry, if one isn't found it makes one.
make sure to change servername, dbusername, dbpassword, & dbname to your settings.