Question regarding SQL data load + loops
#1

I'm loading my vehicles from my MySQL database, however, I'm allowing for players to delete their vehicles in-game and thus obviously a 'DELETE FROM' is called. This causes the id's of the cars on the DB to break out of order (Example: 213, 215, 216)

When the function is called to load the data it gets to the car ID which doesn't exist and creates X amount of cars from the last vehicle loaded. X is equal to the range of missing id's. How do I make it so the loop detects 0 rows returned for the 'SELECT * FROM vehicles WHERE id = X' and stops the load of data for that car, but still continues?

Thanks.
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Why are you looping in the first place? What's wrong with just loading all vehicles in a single query and looping through the results?
I guess I've just always done it this way on everything I code.
Reply
#3

Anyway, for my issue, I'm guessing I have to check the row count for that specific loop and then cause the loop to skip loading for that specific car, and continue to the next ID.

How do I do that? lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)