You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 268 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to correct thousands of users fields

27.11. How to correct thousands of users fields

You have discovered a problem where several (thousands) of your users were added through the edit user screen and ended up with a space (or in some cases 2 spaces) inserted before the e-mail address and other fields. Your bulk e-mails are coming through, but you are not able to effectively search or sort users because of this space. In situations like this, you must be able to correct thousands of users fields, without having to do it manually. Proceed as follows (see exporting nuke_users data):

Create the following PHP script with a decent text editor (Chapter 11):

<?php
include("mainfile.php");
global $prefix, $db, $dbi;
$sql = "SELECT * FROM ".$prefix."_users ORDER BY user_id ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
  $userid = $row['user_id'];
  $oldemail = $row["user_email"];
  $newemail = str_replace (" ","",$oldemail);
  $update = $db->sql_query("UPDATE ".$prefix.
  "_users set user_email='$newemail' where user_id='$userid'");
}
?>

Upload it in the same directory where also the mainfile.php of your PHP-Nuke is located (sinse it includes mainfile.php with a relative, as opposed to absolute, path, it will not work if you upload it in a different place!). Point your browser to it - and the script will do the rest for you!

Caution Backup your database!
 

Always make a backup of your database before trying such a thing! If it breaks, you keep both pieces.


Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.159 Seconds - 389 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::