um, on i mine i put it below the select fields from database query...
I have also used the 'order by' function, this may not be what you want, so soz if it is, i think it will do the same job.
so mine looked like this, urs may look different
SELECT 'table field'
FROM 'your table'
ORDER BY 'id' ASC
the
ORDER BY
function can be changed to either
ASC
(ascending (going up)) or
DESC
(descending(going down)) hope this helps.