Multiple Queries
#1

pawn Код:
public LoadBuget()
{
    new query[128];
    new Data[1024];
    new intBuf[64];
    format(query, sizeof(query), "SELECT * FROM `Primaria` WHERE `Nume` = '%s' LIMIT 1", "Primaria");
    samp_mysql_query(query);
    samp_mysql_store_result();
    samp_mysql_fetch_row(Data);
    samp_mysql_get_field("Capital", intBuf);
    Primaria[Capital] = strval(intBuf);
    samp_mysql_get_field("BonusLupta", intBuf);
    Primaria[BonusLupta] = strval(intBuf);
    printf("Primaria : Capital = %d , BonusLupta = %d",Primaria[Capital],Primaria[BonusLupta]);
    return 1;
}
public LoadBizz(bizid)
{
    new query[128];
    new Data[1024];
    new intBuf[64];
    format(query, sizeof(query), "SELECT * FROM `Bizzuri` WHERE `id` = '%d' LIMIT 1",bizid);
    samp_mysql_query(query);
    samp_mysql_store_result();
    samp_mysql_fetch_row(Data);
    samp_mysql_get_field("Owner", intBuf);
    BizzInfo[bizid][Owner] = strval(intBuf);
    samp_mysql_get_field("Price", intBuf);
    BizzInfo[bizid][Price] = strval(intBuf);
    samp_mysql_get_field("Cx", intBuf);
    BizzInfo[bizid][Cx] = strval(intBuf);
    samp_mysql_get_field("Cy", intBuf);
    BizzInfo[bizid][Cy] = strval(intBuf);
    samp_mysql_get_field("Cz", intBuf);
    BizzInfo[bizid][Cz] = strval(intBuf);
    samp_mysql_get_field("Cix", intBuf);
    BizzInfo[bizid][Cix] = strval(intBuf);
    samp_mysql_get_field("Ciy", intBuf);
    BizzInfo[bizid][Ciy] = strval(intBuf);
    samp_mysql_get_field("Ciz", intBuf);
    BizzInfo[bizid][Ciz] = strval(intBuf);
    samp_mysql_get_field("Intid", intBuf);
    BizzInfo[bizid][Intid] = strval(intBuf);
    samp_mysql_get_field("Fee", intBuf);
    BizzInfo[bizid][Fee] = strval(intBuf);
    samp_mysql_get_field("Status", intBuf);
    BizzInfo[bizid][Status] = strval(intBuf);
    printf(">><<<<");
    printf("Owner : %s , Status : %d , Cx : %f ",BizzInfo[bizid][Owner],BizzInfo[bizid][Status],BizzInfo[bizid][Cx] );
    samp_mysql_free_result();
    return 1;
}
I call them like this ( and the loadstuff function is called with an timer)
pawn Код:
public LoadStuff()
{
    LoadBuget();
    LoadBizz(1);
    return 1;
}
The server crashes and the log show something like this
Код:
[20:35:53] MYSQL: Attempting to connect to server...
[20:35:53] 
Connection to MySQL database: Successfull !
[20:35:53] MYSQL: Database connection established.
[20:35:53] Number of vehicle models: 0
[20:35:59] Primaria : Capital = 300000000 , BonusLupta = 30
The other way

Код:
[20:34:27] MYSQL: Attempting to connect to server...
[20:34:27] 
Connection to MySQL database: Successfull !
[20:34:27] MYSQL: Database connection established.
[20:34:27] Number of vehicle models: 0
[20:34:33] >><<<<
[20:34:33] Owner :  , Status : 0 , Cx : 312.000000
Separately works ok
Reply
#2

Try freeing the result on LoadBuget.
Reply
#3

Same problem , server crashes
Reply
#4

OFF : Wazzup maryo :>, here eXtrike, unignore eXtr1ke please
ON : ..
Reply
#5

12h +
BUMP

LE

The sql table


The bizz


And this is how they load
Код:
[20:43:06] Owner : alexo , Status : 0 , Cx : 310.000000 
[20:43:06] Cy : 311.000000 , CZ : 312.000000 , INTID : 4
Reply
#6

Bump , there must be someone who loads stuff from mysql
Reply
#7

Use one of modern MySQL plugins, then we can talk further.
Reply
#8

I have problem loading that "modern" mysql plugins , im going to try and make an big function that loads all that stuff (houses , bizz , factions cars etc )
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)