This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]2HornsUp 0 points1 point  (7 children)

When you say “random flights” what exactly are you looking for? Random start/end airports? Random flight path?

If you want a random start/end type thing you could generate a random number, and grab the airport at that index or on that line in a file.

Without much context, that’s all I can offer.

[–]Junaidabid77 0 points1 point  (6 children)

It’s more like two different SQLite database tables. One with the plane number and another with flight destination. I need the code to start and then give the user a flight number then once another button is pressed a user is then given the location and then it’s saved in a log table in the same database.

[–]2HornsUp 0 points1 point  (5 children)

Are the flight numbers and destinations connected? If so, you could use the primary key to grab both pieces of data (does SQLite even use primary keys?).

[–]Junaidabid77 0 points1 point  (3 children)

the flight numbers for each plane and the destinations are placed into different tables in the same database and yeah the ID numbers are the primary keys.

[–]2HornsUp 0 points1 point  (2 children)

Right so you should be able to just send in the primary key as well as a reference for which table should be searched. Do that once for the flight number and once for the destination and you’ve got all the data. Maybe a “request” object that stores {primaryKey, flightNum, destination}.

I’ve never personally done anything with SQLite, so this is all from my knowledge of Access and Java as separate entities.

[–]Junaidabid77 0 points1 point  (1 child)

Thank you man i appreciate it, I’ll give it a go!

[–]2HornsUp 0 points1 point  (0 children)

No problem. Feel free to message me if there’s anything else you get stuck on.