I think you should start from scratch!
The code i see in your given pic —> total bullshit, sorry!
Code in line 74 should stay in the FIRST line! What does it do there?
I think you do not tell everything about your project.
You are using a table and a table has rows. Every of that tables rows is the current indexNumber of your databases rows.
Use some consolo-logging, then you will see better what you are doing and which results you get.