Getting the following error:
Warning: rand() expects parameter 2 to be long, array given in C:\wamp\www\honeydev\python.php on line 61
Following is the code:
58 $max_passno=$dbo->prepare("select count(*) from user_password"); //find the max. no of entries in user_password table
59 $max_passno->execute();
60 $row = $max_passno->fetch();
61 $no2 = rand(1, $row); //select a random number
Can someone suggest, what changes are required to resolve this please?
Read the error message again. It states, quite clearly, what the problem is and where it is.
rand(1, 999);
Parameter 2 needs to be a number. For some awesome reason, you threw an array in there. Pretty fun, but it won't work that way.
$max_passno=$dbo->prepare("select count(*) as count from user_password"); //find the max. no of entries in user_password table
$max_passno->execute();
$row = $max_passno->fetch();
$no2 = rand(1, $row['count']); //select a random number
For future reference, it may help to examine the variable in question.
var_dump($row);