原帖由 宅男-兜着走 于 2010-2-12 17:07 发表 
我现在有个table 是Product。
但是 Product 有个特定的 ID。
比如说, L0009 000 ~ L0009 001 ........ n
但是我要怎么才能够弄到他们在Mysql 内 AutoIncrement 呢?
我之前的做法是用 PHP 找最 ...
database just use auto increment 1,2,3 随便
$SQL = "SELECT * FROM table1";
$colum1=取出 auto increment data;
$colum1_length=strlen($colum1);
$length=5; //00000
$for_loop= $length-$colum1_length;
for($i=0;$i< $for_loop;$i++){
$count_zero.="0";
}
$result="Product ".$count_zero.$colum1;
// if colum1 一位数 = 1
//$count_zero = 0000
// result = Product + 0000+ 1
// answer Product 00001
// if colum1 2位数 = 22
//$count_zero = 000
// result = Product + 000+ 22
// answer Product 00022
还没跑过的,你试试看.....