SELECT MYSQL. [+REP]
#1

Sometimes not selects data from the database MYSQL!

After LOGIN:
Код HTML:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "SELECT * FROM `vehicles` WHERE `OwnerID` = %d", pInfo[playerid][pID]); 
mysql_pquery(MySQLCon, QuerY, "OnVehiclesLoad", "d", playerid);
OnVehiclesLoad:
Код HTML:
forward OnVehiclesLoad(playerid);
public OnVehiclesLoad(playerid)
{
    for(new r = 0, vd; r < cache_num_rows(); ++r)
    {
        vd = CreateVehicle(400, -3909.9297, 3914.0884, -0.8315, 50.5536, -1, -1, -1), DestroyVehicle(vd);
        new ORM:ormid = Veh[vd][ORM_ID] = orm_create("vehicles", MySQLCon);
        orm_addvar_int(ormid, Veh[vd][ID], "ID"); //this is the key
        orm_addvar_int(ormid, Veh[vd][Owner], "Owner");
        orm_addvar_int(ormid, Veh[vd][Model], "Model");
        orm_addvar_float(ormid, Veh[vd][PosX], "PosX");
        orm_addvar_float(ormid, Veh[vd][PosY], "PosY");
        orm_addvar_float(ormid, Veh[vd][PosZ], "PosZ");
        orm_addvar_float(ormid, Veh[vd][VAngle], "VAngle");
        orm_addvar_int(ormid, Veh[vd][Color1], "Color1");
        orm_addvar_int(ormid, Veh[vd][Color2], "Color2");
        orm_addvar_int(ormid, Veh[vd][Paintjob], "Paintjob");
        orm_addvar_int(ormid, Veh[vd][Value], "Value");
        orm_addvar_int(ormid, Veh[vd][Lock], "Lock");
        orm_addvar_string(ormid, Veh[vd][Plate], 16, "Plate");
        orm_addvar_float(ormid, Veh[vd][KM], "KM");
        orm_addvar_int(ormid, Veh[vd][Mod][0], "Mod0");
        orm_addvar_int(ormid, Veh[vd][Mod][1], "Mod1");
        orm_addvar_int(ormid, Veh[vd][Mod][2], "Mod2");
        orm_addvar_int(ormid, Veh[vd][Mod][3], "Mod3");
        orm_addvar_int(ormid, Veh[vd][Mod][4], "Mod4");
        orm_addvar_int(ormid, Veh[vd][Mod][5], "Mod5");
        orm_addvar_int(ormid, Veh[vd][Mod][6], "Mod6");
        orm_addvar_int(ormid, Veh[vd][Mod][7], "Mod7");
        orm_addvar_int(ormid, Veh[vd][Mod][8], "Mod8");
        orm_addvar_int(ormid, Veh[vd][Mod][9], "Mod9");
        orm_addvar_int(ormid, Veh[vd][Mod][10], "Mod10");
        orm_addvar_int(ormid, Veh[vd][Mod][11], "Mod11");
        orm_addvar_int(ormid, Veh[vd][Mod][12], "Mod12");
        orm_addvar_int(ormid, Veh[vd][Mod][13], "Mod13");
        orm_addvar_string(ormid, Veh[vd][Class], 13, "Class");
        orm_apply_cache(ormid, r);
        orm_setkey(ormid, "ID"); //here we declare it as the key
        Veh[vd][ServerID] = CreateVehicle(Veh[vd][Model], Veh[vd][PosX], Veh[vd][PosY], Veh[vd][PosZ], Veh[vd][VAngle], Veh[vd][Color1], Veh[vd][Color2], -1),
        VBreak[Veh[vd][ServerID]] = 1, KMVeh[Veh[vd][ServerID]] = Veh[vd][KM], SetVehicleNumberPlate(Veh[vd][ServerID], Veh[vd][Plate]);
    }
    return 1;
}
DEBUG:
Код HTML:
[20:46:35] [debug] Run time error 4: "Array index out of bounds"
[20:46:35] [debug]  Accessing element at index 65535 past array upper bound 1999
[20:46:35] [debug] AMX backtrace:
[20:46:35] [debug] #0 0005f3ec in public OnVehiclesLoad (playerid=4) at C:\Users\HP-PavilionG6\Desktop\GameMode Server\gamemodes\GM.pwn:2579
// Do not select the correct model, and this error occurs.
MYSQL LOG:
Код HTML:
StartCB("OnVehiclesLoad");Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Owner\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Model\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"PosX\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"PosY\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"PosZ\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"VAngle\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Color1\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Color2\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Paintjob\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Value\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Lock\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Plate\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"KM\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod0\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod1\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod2\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod3\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod4\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod5\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod6\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod7\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod8\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod9\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod10\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod11\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod12\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Mod13\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"Class\")",0);
Log("20:46:35","CMySQLResult::GetRowDataByName",2,"field not found (\"ID\")",0);
Reply


Messages In This Thread
SELECT MYSQL. [+REP] - by norton2 - 13.01.2016, 19:06
Re: SELECT MYSQL. [+REP] - by valych - 13.01.2016, 21:35
Re: SELECT MYSQL. [+REP] - by norton2 - 14.01.2016, 13:16

Forum Jump:


Users browsing this thread: 1 Guest(s)