Loading all data from the table
#1

hello, i tried a query to load all the houses on OnGameModeInit with this query:

Код:
SELECT * FROM `house`
and this is the code to actually process the query and make the houses:

pawn Код:
public OnHousesLoaded()
{
    new rows, fields;
    cache_get_data(rows, fields, Gconnection);

    if(rows) {

        new owner[24], Intname[100], X[50], Y[50], Z[50], SQL[50], create;
        cache_get_row(0, 1, owner);
        cache_get_row(0, 3, Intname);
        cache_get_row(0, 5, X);
        cache_get_row(0, 6, Y);
        cache_get_row(0, 7, Z);
        cache_get_row(0, 0, SQL);

        create = HouseCreate(owner, Intname, floatstr(X), floatstr(Y), floatstr(Z));
        HouseInfo[create][SqlID] = strval(SQL);
        print(" it's 'loaded'");

        printf("%s %s %f %f %f %d", owner, Intname, floatstr(X), floatstr(Y), floatstr(Z), strval(SQL));
    }
    return 1;
}
It only loads the first row in the database.. I tried using a while loop but then it spammed loading the same thing.
Reply


Messages In This Thread
Loading all data from the table - by thefatshizms - 05.03.2013, 19:15
Re : Loading all data from the table - by Shidony - 05.03.2013, 19:18
Re: Loading all data from the table - by thefatshizms - 05.03.2013, 19:22
Re: Loading all data from the table - by mamorunl - 05.03.2013, 19:24
Re: Loading all data from the table - by Djole1337 - 05.03.2013, 19:26
Re: Loading all data from the table - by thefatshizms - 05.03.2013, 19:31

Forum Jump:


Users browsing this thread: 4 Guest(s)