Hi,

if it is mysql sorting them with an order by, you probably have declared the id as a text rather than numeric column.
If you are sorting in php, try
sort($array, SORT_NUMERIC)

at least this is what I get from RTFM ...

Musicman