Very weird house load :/
#1

I really don't get this, someone please help.

House loading:

pawn Код:
stock Houses()
{
    mysql_function_query(dbHandle, "SELECT * FROM `Houses`", true, "LoadHouses", "");
}
Call back:

pawn Код:
public LoadHouses()
{
    new string[100], query[100], savedata[50];
    new houseid = 1;
    new rows, fields;
    cache_get_data(rows, fields, dbHandle);
    while(mysql_fetch_row_format(query,"|"))
    {
        HouseInfo[houseid][hID]                 = cache_get_row_int(0, 0, dbHandle);
        cache_get_row(0, 1, savedata); HouseInfo[houseid][hAddress] = strval(savedata);
        cache_get_row(0, 2, savedata); HouseInfo[houseid][hOwner] = strval(savedata);
        HouseInfo[houseid][hPrice]              = cache_get_row_int(0, 3, dbHandle);
        HouseInfo[houseid][hType]               = cache_get_row_int(0, 4, dbHandle);
        HouseInfo[houseid][hVirtualWorld]       = cache_get_row_int(0, 5, dbHandle);
        HouseInfo[houseid][hInterior]           = cache_get_row_int(0, 6, dbHandle);
        HouseInfo[houseid][hPosX]               = cache_get_row_float(0, 7, dbHandle);
        HouseInfo[houseid][hPosY]               = cache_get_row_float(0, 8, dbHandle);
        HouseInfo[houseid][hPosZ]               = cache_get_row_float(0, 9, dbHandle);
        HouseInfo[houseid][hEnterX]             = cache_get_row_float(0, 10, dbHandle);
        HouseInfo[houseid][hEnterY]             = cache_get_row_float(0, 11, dbHandle);
        HouseInfo[houseid][hEnterZ]             = cache_get_row_float(0, 12, dbHandle);
        HouseInfo[houseid][hEnterA]             = cache_get_row_float(0, 13, dbHandle);
        HouseInfo[houseid][hExitX]              = cache_get_row_float(0, 14, dbHandle);
        HouseInfo[houseid][hExitY]              = cache_get_row_float(0, 15, dbHandle);
        HouseInfo[houseid][hExitZ]              = cache_get_row_float(0, 16, dbHandle);
        HouseInfo[houseid][hExitA]              = cache_get_row_float(0, 17, dbHandle);

        HouseInfo[houseid][hPickUp] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hPosX], HouseInfo[houseid][hPosY], HouseInfo[houseid][hPosZ], 0);
        format(string, sizeof(string), "ID: %d\n"Pink"Address"White": %s\n"Pink"Owner"White": %s\n"Pink"Price"White": $%d", HouseInfo[houseid][hID], HouseInfo[houseid][hAddress], HouseInfo[houseid][hOwner], HouseInfo[houseid][hPrice]);
        HouseInfo[houseid][hText] = CreateDynamic3DTextLabel(string, -1, HouseInfo[houseid][hPosX], HouseInfo[houseid][hPosY], HouseInfo[houseid][hPosZ], 20.0);
        format(string, sizeof(string), "House ID: %d, Price: %d, Address: %s, Owner: %s", HouseInfo[houseid][hID], HouseInfo[houseid][hPrice], HouseInfo[houseid][hAddress], HouseInfo[houseid][hOwner]);
        printf(string);
        houseid++;
    }
    printf("All houses have been successfully loaded.");
    return 1;
}




Then in my mysql_log it is now:

Код:
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('0')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('1')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('2')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('3')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('4')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('5')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('6')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('7')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('8')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('9')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('10')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('11')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('12')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('13')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('14')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('15')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('16')
[23:16:23] [WARNING] CMySQLResult::GetRowData - invalid row ('3') or field index ('17')
But as you can see. 0-17 is correct on the cache_get_rows.
Reply
#2

Actually address is a string. do you need to strval() ? same for owner
Reply
#3

pawn Код:
public LoadHouses()
{
    new string[100], query[100], savedata[50];
    new houseid = 1;
    new rows, fields;
    cache_get_data(rows, fields, dbHandle);
    while(mysql_fetch_row_format(query,"|"))
    {
        HouseInfo[houseid][hID]                 = cache_get_row_int(0, 0, dbHandle);
        cache_get_row(0, 1, savedata); format(HouseInfo[houseid][hAddress], 50, savedata);
        cache_get_row(0, 2, savedata); format(HouseInfo[houseid][hOwner], 50, savedata);
        HouseInfo[houseid][hPrice]              = cache_get_row_int(0, 3, dbHandle);
        HouseInfo[houseid][hType]               = cache_get_row_int(0, 4, dbHandle);
        HouseInfo[houseid][hVirtualWorld]       = cache_get_row_int(0, 5, dbHandle);
        HouseInfo[houseid][hInterior]           = cache_get_row_int(0, 6, dbHandle);
        HouseInfo[houseid][hPosX]               = cache_get_row_float(0, 7, dbHandle);
        HouseInfo[houseid][hPosY]               = cache_get_row_float(0, 8, dbHandle);
        HouseInfo[houseid][hPosZ]               = cache_get_row_float(0, 9, dbHandle);
        HouseInfo[houseid][hEnterX]             = cache_get_row_float(0, 10, dbHandle);
        HouseInfo[houseid][hEnterY]             = cache_get_row_float(0, 11, dbHandle);
        HouseInfo[houseid][hEnterZ]             = cache_get_row_float(0, 12, dbHandle);
        HouseInfo[houseid][hEnterA]             = cache_get_row_float(0, 13, dbHandle);
        HouseInfo[houseid][hExitX]              = cache_get_row_float(0, 14, dbHandle);
        HouseInfo[houseid][hExitY]              = cache_get_row_float(0, 15, dbHandle);
        HouseInfo[houseid][hExitZ]              = cache_get_row_float(0, 16, dbHandle);
        HouseInfo[houseid][hExitA]              = cache_get_row_float(0, 17, dbHandle);

        HouseInfo[houseid][hPickUp] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hPosX], HouseInfo[houseid][hPosY], HouseInfo[houseid][hPosZ], 0);
        format(string, sizeof(string), "ID: %d\n"Pink"Address"White": %s\n"Pink"Owner"White": %s\n"Pink"Price"White": $%d", HouseInfo[houseid][hID], HouseInfo[houseid][hAddress], HouseInfo[houseid][hOwner], HouseInfo[houseid][hPrice]);
        HouseInfo[houseid][hText] = CreateDynamic3DTextLabel(string, -1, HouseInfo[houseid][hPosX], HouseInfo[houseid][hPosY], HouseInfo[houseid][hPosZ], 20.0);
        format(string, sizeof(string), "House ID: %d, Price: %d, Address: %s, Owner: %s", HouseInfo[houseid][hID], HouseInfo[houseid][hPrice], HouseInfo[houseid][hAddress], HouseInfo[houseid][hOwner]);
        printf(string);
        houseid++;
    }
    printf("All houses have been successfully loaded.");
    return 1;
}
Reply
#4

Hmm I just tried it, all house ID's are still displaying the same and that row warning still occurs
Reply
#5

pawn Код:
public LoadHouses()
{
    new string[100], query[100], savedata[50];
    new houseid = 1;
    new rows, fields;
    cache_get_data(rows, fields, dbHandle);
    for(new r = 0; r != rows; r++) {
        HouseInfo[houseid][hID]                 = cache_get_row_int(r, 0, dbHandle);
        cache_get_row(r, 1, savedata); format(HouseInfo[houseid][hAddress], 50, savedata);
        cache_get_row(r, 2, savedata); format(HouseInfo[houseid][hOwner], 50, savedata);
        HouseInfo[houseid][hPrice]              = cache_get_row_int(r, 3, dbHandle);
        HouseInfo[houseid][hType]               = cache_get_row_int(r, 4, dbHandle);
        HouseInfo[houseid][hVirtualWorld]       = cache_get_row_int(r, 5, dbHandle);
        HouseInfo[houseid][hInterior]           = cache_get_row_int(r, 6, dbHandle);
        HouseInfo[houseid][hPosX]               = cache_get_row_float(r, 7, dbHandle);
        HouseInfo[houseid][hPosY]               = cache_get_row_float(r, 8, dbHandle);
        HouseInfo[houseid][hPosZ]               = cache_get_row_float(r, 9, dbHandle);
        HouseInfo[houseid][hEnterX]             = cache_get_row_float(r, 10, dbHandle);
        HouseInfo[houseid][hEnterY]             = cache_get_row_float(r, 11, dbHandle);
        HouseInfo[houseid][hEnterZ]             = cache_get_row_float(r, 12, dbHandle);
        HouseInfo[houseid][hEnterA]             = cache_get_row_float(r, 13, dbHandle);
        HouseInfo[houseid][hExitX]              = cache_get_row_float(r, 14, dbHandle);
        HouseInfo[houseid][hExitY]              = cache_get_row_float(r, 15, dbHandle);
        HouseInfo[houseid][hExitZ]              = cache_get_row_float(r, 16, dbHandle);
        HouseInfo[houseid][hExitA]              = cache_get_row_float(r, 17, dbHandle);

        HouseInfo[houseid][hPickUp] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hPosX], HouseInfo[houseid][hPosY], HouseInfo[houseid][hPosZ], 0);
        format(string, sizeof(string), "ID: %d\n"Pink"Address"White": %s\n"Pink"Owner"White": %s\n"Pink"Price"White": $%d", HouseInfo[houseid][hID], HouseInfo[houseid][hAddress], HouseInfo[houseid][hOwner], HouseInfo[houseid][hPrice]);
        HouseInfo[houseid][hText] = CreateDynamic3DTextLabel(string, -1, HouseInfo[houseid][hPosX], HouseInfo[houseid][hPosY], HouseInfo[houseid][hPosZ], 20.0);
        format(string, sizeof(string), "House ID: %d, Price: %d, Address: %s, Owner: %s", HouseInfo[houseid][hID], HouseInfo[houseid][hPrice], HouseInfo[houseid][hAddress], HouseInfo[houseid][hOwner]);
        printf(string);
        houseid++;
    }
    printf("All houses have been successfully loaded.");
    return 1;
}
try like that
Reply
#6

It's working now, thanks. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)