SQL Loading Issue
#1

Am I doing something wrong with this? For some reason it's not loading any of the information correctly.

pawn Код:
public LoadHouses()
{
    new rows, fields;
    cache_get_data(rows, fields);
   
    HouseCount = rows;

    for(new i = 1; i <= rows; i++)
    {
        cache_get_field_content(i, "owner", HouseInfo[i][Owner], g_Handle, 24);
        HouseInfo[i][Status] = cache_get_field_content_int(i, "status");
        HouseInfo[i][Interior] = cache_get_field_content_int(i, "interior");
        HouseInfo[i][Price] = cache_get_field_content_int(i, "price");
        HouseInfo[i][XPos] = cache_get_field_content_float(i, "xpos");
        HouseInfo[i][YPos] = cache_get_field_content_float(i, "ypos");
        HouseInfo[i][ZPos] = cache_get_field_content_float(i, "zpos");
        HouseInfo[i][EnterX] = cache_get_field_content_float(i, "enterx");
        HouseInfo[i][EnterY] = cache_get_field_content_float(i, "entery");
        HouseInfo[i][EnterZ] = cache_get_field_content_float(i, "enterz");

        HousePickup[i] = CreatePickup(1273, 1, HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos]);
        CreateHouseLabels(i);
    }
   
    printf("--- %i houses loaded from the SQL Database. ---", HouseCount);

    return 1;
}
And my sql log

Код:
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
Reply
#2

start at new i=0
Reply
#3

I had that before and I was getting a similar issue. I found that the issue was in my declaration of HouseCount. Thank you.
Reply
#4

Not too important, but why are you using those local vars for rows and fields, consider doing this.
pawn Код:
public LoadHouses()
{
    HouseCount = cache_get_row_count();

    for(new i; i <= HouseCount; i++)
    {
        cache_get_field_content(i, "owner", HouseInfo[i][Owner], g_Handle, 24);
        HouseInfo[i][Status] = cache_get_field_content_int(i, "status");
        HouseInfo[i][Interior] = cache_get_field_content_int(i, "interior");
        HouseInfo[i][Price] = cache_get_field_content_int(i, "price");
        HouseInfo[i][XPos] = cache_get_field_content_float(i, "xpos");
        HouseInfo[i][YPos] = cache_get_field_content_float(i, "ypos");
        HouseInfo[i][ZPos] = cache_get_field_content_float(i, "zpos");
        HouseInfo[i][EnterX] = cache_get_field_content_float(i, "enterx");
        HouseInfo[i][EnterY] = cache_get_field_content_float(i, "entery");
        HouseInfo[i][EnterZ] = cache_get_field_content_float(i, "enterz");

        HousePickup[i] = CreatePickup(1273, 1, HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos]);
        CreateHouseLabels(i);
    }

    printf("--- %i houses loaded from the SQL Database. ---", HouseCount);

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)