MySQL AI Problem
#1

I have a house system in MySQL, and when I create a house it loops thorught out all houses and checks the next loop

PHP код:
stock House_Next() {
       new 
number= -1;
    for(new 
1sizeof(HouseInfo); i++) {
        if(
HouseInfo[i][h_Created] == false) {
            
numberi;
            break;
        }
    }
    return 
broj;

But If i delete a house using the standard query "DELETE * FROM `houses` WHERE `sqlid` blbal" the next house will be ID: 5 ingame but ID 6 in sql can i fix that somehow or?
Reply
#2

Check the ID table in your phpmyadmin if has AUTOINCREMENT=6, probably because you added a house (+1 ID) and removed and ID hasn't been updated.
Reply
#3

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
Check the ID table in your phpmyadmin if has AUTOINCREMENT=6, probably because you added a house (+1 ID) and removed and ID hasn't been updated.
So every time I delete a house I need to modify AI?
Reply
#4

wtf are you doing?
when you are inserting house or loading them you also save houses auto increcment id.
Reply
#5

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
wtf are you doing?
when you are inserting house or loading them you also save houses auto increcment id.
Yes but if he has 5 houses (so max ID: 5), then he adds 1, becomes ID: 6, but if he remove previously created house, ID will still be 6.

I know this because i have 3 dynamic systems which uses ID as autoincrement, and i have this problem too.

@IdonTmiss no you don't need, maybe you need just when migrating database because when u export the .sql file, query will be AUTOINCREMENT = 6 (even if u have max 5 houses).
Reply
#6

http://forum.sa-mp.com/showpost.php?...67&postcount=3
This post its actually pretty good. You dont really need to to use AI especially in a house system which gonna contain deleting
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)