Loading business with MySQL
#1

Hello, I'm trying to save the business from my server for MySQL here I am trying to read because I inserted in the database. Manually.

I guess you're wrong as well, I just want it to carry business, but when I start it from the crash. the sa-mp server closes alone.

My attempts:

pawn Код:
public LoadBizz()
{
        new idx;
        while (idx < sizeof(BizzInfo))
        {
            new Str[237];
            format(Str,115,"SELECT `Vendida`, `Dono`, `Mensagem`, `Extorcao`, `EntradaX`, `EntradaY`, `EntradaZ`, `SaidaX`, `SaidaY`, `SaidaZ`,");
            format(Str,237,"%s `LevelNecessario`, `PrecoCompra`, `EntradaCusto`, `Till`, `Trancada`, `Interior` FROM `empresas` WHERE `ID`='%i'",Str, idx);
            mysql_function_query(Connect, Str, true, "LooadBizz", "i", idx);
            idx++;
        }
        printf("%d Empresas Carregadas", idx);
    return 1;
}
pawn Код:
forward LooadBizz(idx);
public LooadBizz(idx)
{
    new rows, fields,temp[25];
    cache_get_data(rows, fields);
    if(rows)
    {
    cache_get_row(0, 0, temp), BizzInfo[idx][bOwned] = strval(temp);
    cache_get_row(0, 1, temp), BizzInfo[idx][bOwner] = strval(temp);
    cache_get_row(0, 2, temp), BizzInfo[idx][bMessage] = strval(temp);
    cache_get_row(0, 3, temp), BizzInfo[idx][bExtortion] = strval(temp);
    cache_get_row(0, 4, temp), BizzInfo[idx][bEntranceX] = strval(temp);
    cache_get_row(0, 5, temp), BizzInfo[idx][bEntranceY] = strval(temp);
    cache_get_row(0, 6, temp), BizzInfo[idx][bEntranceZ] = strval(temp);
    cache_get_row(0, 7, temp), BizzInfo[idx][bExitX] = strval(temp);
    cache_get_row(0, 8, temp), BizzInfo[idx][bExitY] = strval(temp);
    cache_get_row(0, 9, temp), BizzInfo[idx][bExitZ] = strval(temp);
    cache_get_row(0, 10, temp), BizzInfo[idx][bLevelNeeded] = strval(temp);
    cache_get_row(0, 11, temp), BizzInfo[idx][bBuyPrice] = strval(temp);
    cache_get_row(0, 12, temp), BizzInfo[idx][bEntranceCost] = strval(temp);
    cache_get_row(0, 13, temp), BizzInfo[idx][bTill] = strval(temp);
    cache_get_row(0, 14, temp), BizzInfo[idx][bLocked] = strval(temp);
    cache_get_row(0, 15, temp), BizzInfo[idx][bInterior] = strval(temp);
    }
    return 1;
}

I will be very grateful to those who help me.

Thank you!

and sorry for the English.

@EDIT: In total there are 7 business.
Database:
Reply


Messages In This Thread
Loading business with MySQL - by iryston - 18.11.2013, 23:18
Re: Loading business with MySQL - by iryston - 19.11.2013, 13:04
Re: Loading business with MySQL - by InfiniTy. - 19.11.2013, 13:26
Re: Loading business with MySQL - by iryston - 19.11.2013, 14:47

Forum Jump:


Users browsing this thread: 2 Guest(s)