Having a little trouble parsing your English here ... are you saying that the 2nd place score appears in the 1st place box, or that the 2nd place score appears on your "New Game" button?
Couple of points ...
First: you probably want to order the scores as you pull them out of the database. If you don't use an "order by" clause the DB is free to return them in any order it feels like - one day the 3rd place guy is first, and the next day he's the 15th row returned. Add an "order by score" or "order by score desc" (assuming "score" is a number - if it's a character you got more work to do).
Second: It's bad form to have a global variable called "statement" and a local variable with the same name. You can do it ... but then you might as well do all your variables "aaaa1", "aaaa2", "aaaa3", and so on. Not sure why you first open your DB, then check your global statement var, then initialize a new "statement" - but I'm sure you've got your reasons. Seems a weird way of tracking a high score hit ...
Having a little trouble parsing your English here ... are you saying that the 2nd place score appears in the 1st place box, or that the 2nd place score appears on your "New Game" button?
Couple of points ...
First: you probably want to order the scores as you pull them out of the database. If you don't use an "order by" clause the DB is free to return them in any order it feels like - one day the 3rd place guy is first, and the next day he's the 15th row returned. Add an "order by score" or "order by score desc" (assuming "score" is a number - if it's a character you got more work to do).
Second: It's bad form to have a global variable called "statement" and a local variable with the same name. You can do it ... but then you might as well do all your variables "aaaa1", "aaaa2", "aaaa3", and so on. Not sure why you first open your DB, then check your global statement var, then initialize a new "statement" - but I'm sure you've got your reasons. Seems a weird way of tracking a high score hit ...
the score is a string, could change that and use order by, good point, forgot about it.
2th point, i used it from an example, as i am kinda new to objective c.
the point is, it will not get the names in the labels and the score neither.
thx for your reply, hopefully you can see the error..
the score is a string, could change that and use order by, good point, forgot about it.
2th point, i used it from an example, as i am kinda new to objective c.
the point is, it will not get the names in the labels and the score neither.
thx for your reply, hopefully you can see the error..
From the snippet you've provided - no. Could be a million reasons. Plus you aren't telling what you ARE seeing - are you getting errors, "gelukt", or what have you?
First thing I'd check is that you linked up your variables and outlets. Then I'd throw some NSLog statements in and verify you actually are pulling data from the database - in other words, is there actually data to pull? If your table is empty then your program is working fine!
From the snippet you've provided - no. Could be a million reasons. Plus you aren't telling what you ARE seeing - are you getting errors, "gelukt", or what have you?
First thing I'd check is that you linked up your variables and outlets. Then I'd throw some NSLog statements in and verify you actually are pulling data from the database - in other words, is there actually data to pull? If your table is empty then your program is working fine!
gelukt= passed in dutch.
i have reconnecting the outlets then i got null errors with the nsstring line(in the while loop)
also i used 2 nslog, 1 on writeblepath, it gave me a path, and the 2th one on database variable, not sure what that 1 does, but it came out with nothing.
but how can i see into the database of the db on the ipad?
... but how can i see into the database of the db on the ipad?
Yeah ... okay ... let's start from first principles.
Question: does your database have any data?
See - your call to open will create the database if it didn't already exist. And an empty database would contain no tables. You are not checking the return code on your prepare statement - and while I would hope the step would fail (i.e. return something other than a success code) on a bad statement, it could be one of those "undefined" things.
And, apparently, you chose not to write the values of tennisName or tennisScore to NSLog (hint hint).
Run it on the simulator, then navigate into the folder $HOME/Library/Application Support/iPhone Simulator/<version>/Applications/<app>/Documents, open your DB file (I'd suggest downloading a sqlite GUI because it doesn't seem like you have a whole lot of DB experience), and look. If there's no data, then I'd think you have an EBKAC issue.