SQL won't load houses.
#1

I have this function:

pawn Код:
LoadHouses()
{
    mysql_query("SELECT NULL FROM houses");
    mysql_store_result();
    new rows = mysql_num_rows();
    mysql_free_result();

    CheckMySQL();

    for(new i; i < rows; i++) {
        new string[128];
        format(string, sizeof(string), "SELECT * FROM houses WHERE ID = '%d'", i);
        mysql_query(string);
        mysql_store_result();

        new row[128];
        new field[15][24];
        mysql_fetch_row_format(row, "|");
        explode(row, field, "|");
        mysql_free_result();
        HD[i][ID] = strval(field[0]);
        format(HD[i][owner], 32, "%s", field[1]);
        format(HD[i][hname], 24, "%s", field[2]);
        HD[i][hprice] = strval(field[3]);
        HD[i][exteriorX] = floatstr(field[4]);
        HD[i][exteriorY] = floatstr(field[5]);
        HD[i][exteriorZ] = floatstr(field[6]);
        HD[i][interiorX] = floatstr(field[7]);
        HD[i][interiorY] = floatstr(field[8]);
        HD[i][interiorZ] = floatstr(field[9]);
        HD[i][interiorInt] = strval(field[10]);
        HD[i][locked] = strval(field[11]);
        HD[i][gunslot1] = strval(field[12]);
        HD[i][locklevel] = strval(field[13]);
        HD[i][safeamount] = strval(field[14]);
        if(strlen(HD[i][owner]) > 0) CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
        else CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
        Create3DTextLabel(HD[i][hname], 0x000000AA, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], 5.0, 0);
        printf("House %d spawned @ %f, %f, %f", i, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ]);
    }
}
Yet it doesn't spawn. All it says on the "printf" is:

House 0 spawned @ 0.000000, 0.000000, 0.000000

Thanks.
Reply


Messages In This Thread
SQL won't load houses. - by iGetty - 17.05.2012, 03:12
Re: SQL won't load houses. - by Mandrakke - 17.05.2012, 03:34
Re: SQL won't load houses. - by iGetty - 17.05.2012, 03:43
Re: SQL won't load houses. - by Mandrakke - 17.05.2012, 03:47
Re: SQL won't load houses. - by iGetty - 17.05.2012, 03:50
Re: SQL won't load houses. - by Mandrakke - 17.05.2012, 04:07
Re: SQL won't load houses. - by iGetty - 17.05.2012, 04:19
Re: SQL won't load houses. - by Mandrakke - 17.05.2012, 04:27

Forum Jump:


Users browsing this thread: 1 Guest(s)