Good day,
I am new to PHP and I am trying to add a random password for my clients when they are verified. The script I am using is as follows:
<?php
function genpwd($cnt)
{
$pwd = str_shuffle('abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@#%$*');
return substr($pwd,0,$cnt);
$password=genpwd(6);
}
echo genpwd(6);
$conn = mysql_connect('localhost','database','password') or die('Iam dying');
mysql_select_db('database_table',$conn);
$string = "insert into `Table` (`password`) values ('$password')";
mysql_query($string,$conn);
mysql_close();
?>
What is happening is that a database entry is created but there is nothing in the password field. Any suggestions??
I am new to PHP and I am trying to add a random password for my clients when they are verified. The script I am using is as follows:
<?php
function genpwd($cnt)
{
$pwd = str_shuffle('abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@#%$*');
return substr($pwd,0,$cnt);
$password=genpwd(6);
}
echo genpwd(6);
$conn = mysql_connect('localhost','database','password') or die('Iam dying');
mysql_select_db('database_table',$conn);
$string = "insert into `Table` (`password`) values ('$password')";
mysql_query($string,$conn);
mysql_close();
?>
What is happening is that a database entry is created but there is nothing in the password field. Any suggestions??