【发布时间】:2018-08-03 07:22:21
【问题描述】:
这是我生成序列号的模型函数
public function getmax($field_name,$table_name){
$this->db->select_max($field_name);
$res1 = $this->db->get($table_name);
if ($res1->num_rows() > 0) {
$res2 = $res1->result_array();
}
$max = $res2[0][$field_name];
if($max == NULL) return 1; else return $max+1;
}
这是我的控制器功能
$CardNo = $this->general_model->getmax('card_number','digicardusers');
我想设置从00000000001开始的序列号。如何更改代码以获得11位序列号。请帮助
【问题讨论】:
-
$randnum = rand(1111111111,9999999999);
-
在这段代码中我可以在哪里使用它
-
@suresh serial != random
-
你能给我举个例子你想如何生成吗?
-
从 00000000001@suresh 开始的数字
标签: php codeigniter model