Jump to content

Mass user registration by admin


saurabhdutta

Recommended Posts

Hi..

I am really new to PHP/MySQL. Could any one of you help me with registering 100 users with their email addresses, passwords and phone numbers from a single admin page. and then the mailer should sent out mails to each of these users notifying them about the account creation.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/40977-mass-user-registration-by-admin/
Share on other sites

I would start by getting all data into an array so you can loop through and do what you want. i.e.

 


$data['email'][]=
$data['password'][]=
$data['phone'][]=

 

Person 1's data is

 


$data['email'][0]
$data['password'][0]
$data['phone'][0]

 

Person 2 would be

 


$data['email'][1]
$data['password'][1]
$data['phone'][1]

 

This will allow you to address each one inside a while loop.

 

<?php
$x=0;

while( $x < $total_results ){ 

$email = $data['email'][$x];
$password = $data['password'][$x];
$phone = $data['phone'][$x];


$query="INSERT INTO users (email,password,phone) values ($email, $password, $phone)";
$result=mysql_query($query);

// mail code here
//mail code here
//mail code here
//mail code here

$x++;
}

?>

 

Rough draft and crude, but its a start.

 

Hope it helps

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.