Hello,

I have a database of about 40K members, which I want to port to MySQL. This
is not the problem, my problem is that I have the following table:

CREATE TABLE Person (
  PersonID int(11) NOT NULL auto_increment,
  Title varchar(10) default NULL,
  FirstName varchar(35) NOT NULL default '',
  Initials varchar(5) default NULL,
  Surname varchar(35) NOT NULL default '',
  Email varchar(45) default NULL,
  LoginName varchar(10) NOT NULL default '',
  Password varchar(10) default NULL,
  PreviousSource varchar(10) default NULL,
  RegDate timestamp(14) NOT NULL,
  FK_BusID int(11) NOT NULL default '0',
  FK_GroupsID int(11) NOT NULL default '0',
  FK_JobFunID int(11) NOT NULL default '0',
  FK_SourceID int(11) NOT NULL default '0',
  FK_StatusID int(11) NOT NULL default '0',
  FK_PurchaseID int(11) NOT NULL default '0',
  JobTitle varchar(40) default NULL,
  Tel varchar(20) default NULL,
  Fax varchar(20) default NULL,
  PRIMARY KEY  (PersonID),
  KEY IDX_Person (LoginName,Surname)
) TYPE=ISAM;


I have all the data, but I would like to add the LoginName and Password
during the import of the raw data so that each of these are unique and
randomly generated.

I have a form which does this, in php, but I can only add one record at a
time, is there a way in which I can "ask" the script to look up the import
file, load the data onto the database and for each record generate a
LoginName and Password.

Here is the part of my php form that generates the LoginName & Password for
individual entries.

// generate login name from fname, lname, rand
// seed with microseconds since last "whole" second
srand ((double) microtime() * 1000000);
$randval = rand();
$reglogin = substr($fname,0,2) . substr($lname,0,2) . $randval;
$reglogin = substr($reglogin, 0, 10);
$passwd = generateRandomPassword();


Your advice is much appreciated.

Many thanks

Norman




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to