11 桁の乱数を生成するコードを作成し、すべての数値をデータベースに保存したい
admin_create_epin.ctp(表示)
<tr>
Add E-pin:(No of E-Pin)
<td><?php echo $this->Form->input('e_pin',array('label'=>false));?></td>
</tr>
epins_controller.php
public function admin_create_epin(){
$limit = $this->data['Epin']['e_pin'];
for($i=0;$i<$limit;$i++)
{
$random = substr(number_format(time() * rand(),0,'',''),0,11)."<br/>";
$this->data['Epin']['e_pin'] = $random;
//pr($this->data); it's show all random number
$this->Epin->save($this->data); // i have problem only here it's save only last random number
$this->Session->setFlash("Epin has been added");
$this->Redirect(array('action'=>'admin_create_epin'));
}
}
問題:コードはすべての乱数を生成しますが、すべてではなく最後の乱数のみを挿入するコードに問題があり、すべての乱数を挿入したい
ありがとう