in reply to database not in correct order

You should never assume an order to the results of a SQL query which doesn't have an ORDER BY clause. Without that clause, every single RDBMS states that the ordering is undefined.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?