Loading all data from the table
#4

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

    if(rows) {
        for(new i = 0; i < rows; i++) {
        new owner[24], Intname[100], X[50], Y[50], Z[50], SQL[50], create;
        cache_get_row(i, 1, owner);
        cache_get_row(i, 3, Intname);
        cache_get_row(i, 5, X);
        cache_get_row(i, 6, Y);
        cache_get_row(i, 7, Z);
        cache_get_row(i, 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;
}
rows gives you the number of rows back. So you can loop through them with a for loop, or a while, but you have to keep track of which rows you have done already.
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: 3 Guest(s)