oh god, somehow mysql_rownumber does now that what I want.. it returns the value of rows.
ok, so my problem will be solved
but anyway, the function shouldn't crash when you type in an non existing row