开发者

Serial number in PHP

开发者 https://www.devze.com 2023-03-08 15:31 出处:网络
Please I am building a table in php that will list item from database, the amount listed depends on amount available. I want to number my s/n column serially using php.

Please I am building a table in php that will list item from database, the amount listed depends on amount available. I want to number my s/n column serially using php. eg.

s/n      Name       amoun开发者_StackOverflowt
1       Mathew     $12
2
3
4
etc


Try MYSQL's auto increment. So the first user who registers gets SN 1 and second would get 2 etc

http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html


see range()

<?php
// array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
foreach (range(0, 12) as $number) {
    echo $number;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号