I'm having problem with my query, it inserts the same the value again and again even though the value of the variable is different.
Here is the first page. it contains a randomizer for the creation of accounts.
function getRandomString($length = 10) {
$validCharacters = "1234567890";
$validCharNumber = strlen($validCharacters);
$result = "";
for ($i = 0; $i < $length; $i++) {
$index = mt_rand(0, $validCharNumber - 1);
$result .= $validCharacters[$index];
}
return $result;
}
$idNo=getRandomString();
function getRandomPassword($length = 6) {
$validCharacters = "qwertyuiopasdfghjklzxcvbnm1234567890";
$validCharNumber = strlen($validCharacters);
$result = "";
for ($i = 0; $i < $length; $i++) {
$index = mt_rand(0, $validCharNumber - 1);
$result .= $validCharacters[$index];
}
return $result;
}
$password=getRandomPassword();
The values will then be submitted to the next page which is below. The submitted values are correct because i print them out first to check. It always inserts the value "2147483647" for the ID_No even though this is not the randomize value.
$insert = "INSERT INTO person (ID_No, P_Word, E_Status)
VALUES('$userName', '$userPass', 'Applicant')";
$result = mysql_query($insert);
How do you fix this? Is it a bug?