Hm..
Not sure what your problem is. It sounds like me you should perhaps start off with reading some general info on th euse of databases and dynamic page building?
Just giving you a piece of code is -impossible without more information
and/or -useless at thjis point.
In general, you can decide which part o fthe table to select: Specfiic colums, or the whole record. If you select the whole record, you can include your ID colum, which should hold your 'serial numbers'
But as I said.. Do some reading on the tutorials on PhP / MySQL website building.
J.