Problem with mysql loading
#1

Okay, I have dynamic businesses that save fine etc

Here is my business load code:
pawn Код:
forward LoadBusinesses(b);
public LoadBusinesses(b)
{
    new Fields, Rows, szResult[128], szLabel[128], iIndex;

    cache_get_data(Rows, Fields, iConnectionHandle);

    switch(b)
    {
        case QUERY_LOAD_BIZS:
        {
            while(iIndex < MAX_BUSINESSES)
            {
           
                if(mysql_num_rows(iConnectionHandle) > 0)
                {
                cache_get_field_content(Rows, "ID", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bSQLID] = strval(szResult);

                cache_get_field_content(Rows, "Name", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bName] = strlen(szResult);
               
                cache_get_field_content(Rows, "SMessage", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bSMessage] = strlen(szResult);

                cache_get_field_content(Rows, "Owner", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bOwner] = strlen(szResult);

                cache_get_field_content(Rows, "Type", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bType] = strval(szResult);

                cache_get_field_content(Rows, "Stock", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bStock] = strval(szResult);

                cache_get_field_content(Rows, "Price", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bPrice] = strval(szResult);

                cache_get_field_content(Rows, "Alarm", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bAlarm] = strval(szResult);

                cache_get_field_content(Rows, "Level", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bLevel] = strval(szResult);

                cache_get_field_content(Rows, "EPay", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bEPay] = strval(szResult);

                cache_get_field_content(Rows, "Lock", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bLock] = strval(szResult);

                cache_get_field_content(Rows, "EVW", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bVW][0] = strval(szResult);

                cache_get_field_content(Rows, "IVW", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bVW][1] = strval(szResult);

                cache_get_field_content(Rows, "EInt", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bInt][0] = strval(szResult);

                cache_get_field_content(Rows, "IInt", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bInt][1] = strval(szResult);

                cache_get_field_content(Rows, "ExtX", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bEPos][0] = floatstr(szResult);

                cache_get_field_content(Rows, "ExtY", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bEPos][1] = floatstr(szResult);

                cache_get_field_content(Rows, "ExtZ", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bEPos][2] = floatstr(szResult);

                cache_get_field_content(Rows, "ExtA", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bEPos][3] = floatstr(szResult);

                cache_get_field_content(Rows, "IntX", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bIPos][0] = floatstr(szResult);

                cache_get_field_content(Rows, "IntY", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bIPos][1] = floatstr(szResult);

                cache_get_field_content(Rows, "IntZ", szResult, iConnectionHandle);
                BusinessInfo[b][bIPos][2] = floatstr(szResult);

                cache_get_field_content(Rows, "IntA", szResult, iConnectionHandle);
                BusinessInfo[iIndex][bIPos][3] = floatstr(szResult);
               
                format(szLabel, sizeof(szLabel), "%s\n\n[%s]\n[Owner: %s]\n[Status: %s]", BusinessInfo[iIndex][bName], ReturnBusinessType(iIndex), BusinessInfo[iIndex][bOwner], ReturnBusinessLockStatus(iIndex));
                BusinessInfo[iIndex][bLabel] = Create3DTextLabel(szLabel, COLOR_WHITE, BusinessInfo[iIndex][bEPos][0], BusinessInfo[iIndex][bEPos][1], BusinessInfo[iIndex][bEPos][2], 10.0, BusinessInfo[iIndex][bVW][0]);
                BusinessInfo[iIndex][bPickup] = CreatePickup(1239, 23, BusinessInfo[iIndex][bEPos][0], BusinessInfo[b][bEPos][1], BusinessInfo[iIndex][bEPos][2], BusinessInfo[iIndex][bVW][0]);

                b++;
               
                }
               
                printf("[SERVER]: %d businesses were loaded.", iIndex);
                return 1;
            }
        }
    }
    return 1;
}
Idk why, but it always loaded 0 businesses when their is businesses in the database

I have this under OnGameModeINit
mysql_function_query(iConnectionHandle, "SELECT * FROM businesses", true, "LoadBusinesses", "d", QUERY_LOAD_BIZS);
Reply


Messages In This Thread
Problem with mysql loading - by MattSlater - 25.01.2013, 15:45
Re: Problem with mysql loading - by Vince - 25.01.2013, 16:08
Re: Problem with mysql loading - by MattSlater - 25.01.2013, 18:33
Re: Problem with mysql loading - by Vince - 25.01.2013, 19:31
Re: Problem with mysql loading - by MattSlater - 25.01.2013, 23:48
Re: Problem with mysql loading - by MattSlater - 27.01.2013, 12:42
Re: Problem with mysql loading - by MattSlater - 28.01.2013, 19:04
Re: Problem with mysql loading - by Bakr - 28.01.2013, 20:00
Re: Problem with mysql loading - by thefatshizms - 28.01.2013, 21:11

Forum Jump:


Users browsing this thread: 1 Guest(s)