There are two options as I see, first you may check the database and see how the records are constructed second you
may post your code somewhere like in the pastebin, so that I can review and tell you?
may post your code somewhere like in the pastebin, so that I can review and tell you?