hi i have a code and i need some help!! im making a password genorator and i have a while loop and it shows 4 codes eg. 11123-11123-11123-11123 but it makes this in the while and i want to make the output of the whil into a varible and then add it to my sql database here is code
function password(){
// start with a blank password
$password = "";
// define possible characters
$possible = "".$_SESSION['numeric']."".$_SESSION['alpha']."".$_SESSION['mixed']."";
// set up a counter
$i = 0;
// add random characters to $password until $length is reached
while ($i < $_REQUEST['length']) {
// pick a random character from the possible ones
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
// we don't want this character if it's already in the password
if (!strstr($password, $char)) {
$password .= $char;
$i++;
}
}
// done!
echo"$password";
}
while ($p < $_REQUEST['times']) {
if($p < 3){$a="-";}else{$a="";}
$code1=password();
echo"$a";
$p++;}