-1
得到以下错误:警告:兰特()预计参数长
Warning: rand() expects parameter 2 to be long, array given in C:\wamp\www\honeydev\python.php on line 61
以下是代码:
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
有人建议,需要什么样的变化来解决这个好吗?
'$ row'是一个数组,不是数字。数组中的元素,而不是数组本身。 – deceze 2015-02-07 07:08:41
'$ count = $ max_passno-> fetchColumn(); $ no2 = rand(1,$ count);' – 2015-02-07 07:13:00
谢谢@Jack !!!你应该已经发布了这个答案! – Technolust 2015-02-07 07:50:09