If you insist on using your own text-file based database, and not use some kind of DB, there are some ways to get around this. ( just note that this is not tested in any way, major bugs may come along )
- You can make another file that stores the deleted IDs and when you add a new ID you first check if it is deleted, and you can give a new member the ID of 2 that was deleted earlier.
- Instead of just counting the lines, why not read the number from your lines to figure out what ID you're at, just split the last line with '|' and take the first value. This way you know where you're at, and add a new ID
As I said, untested for bugs, and I'm sure there are plenty other ways to do it, you just have to find what's best to do it with.
Chady |
http://chady.net/