Saving Vehicle(SQL R39)
#1

What am I doing wrong here?
The vehicles spawn, however they do not save to the 'vehicles' Database.

pawn Код:
CMD:createveh(playerid,params[]){

    new query[128], vehid;
    mysql_format(db_connect,query,sizeof(query),"SELECT vID FROM vehicles");
    new Cache:result = mysql_query(db_connect,query);

    for(new i = 0; i < cache_get_row_count(); i++){
        vehcount = cache_get_field_content_int(i,"vID");
    }
    cache_delete(result);

    if(sscanf(params,"i",vehid))return SendClientMessage(playerid,-1,"Usage: {FF0000}/createveh [vehicleid]");

    vehcount++;
    D_Info[vehcount][v_Model] = vehid;
    GetPlayerFacingAngle(playerid, D_Info[vehcount][v_A]);
    GetPlayerPos(playerid,D_Info[vehcount][v_X],D_Info[vehcount][v_Y],D_Info[vehcount][v_Z]);
    CreateVehicle(D_Info[vehcount][v_Model], D_Info[vehcount][v_X],D_Info[vehcount][v_Y],D_Info[vehcount][v_Z], D_Info[vehcount][v_A], -1, -1, 60000);

    mysql_format(db_connect,query,sizeof(query), "INSERT INTO `vehicles` (`Owned`, `Locked`, `Forsale`, `Team`, `Color`,\
    `Color2`, `X`, `Y`, `Z`, `FAngle`, `Price`, `Model`) VALUES (0,0,0,0,0,0,0,0,0,0,0,0)"
);
    mysql_tquery(db_connect, query, "", "");
    return 1;
}
SQL Log
Код:
[12:23:57] [DEBUG] mysql_format - connection: 0, len: 128, format: "SELECT vID FROM vehicles"
[12:23:57] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[12:23:57] [DEBUG] mysql_query - connection: 0, query: "", use_cache: true
[12:23:57] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[12:23:57] [DEBUG] cache_get_row_count - connection: 1
[12:23:57] [WARNING] cache_get_row_count - no active cache
[12:23:57] [DEBUG] cache_delete - cache_id: 0, connection: 1
[12:23:57] [WARNING] CMySQLHandle::DeleteSavedResult - invalid result id ('0')
[12:24:00] [DEBUG] mysql_format - connection: 0, len: 128, format: "SELECT vID FROM vehicles"
[12:24:00] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[12:24:00] [DEBUG] mysql_query - connection: 0, query: "", use_cache: true
[12:24:00] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[12:24:00] [DEBUG] cache_get_row_count - connection: 1
[12:24:00] [WARNING] cache_get_row_count - no active cache
[12:24:00] [DEBUG] cache_delete - cache_id: 0, connection: 1
[12:24:00] [WARNING] CMySQLHandle::DeleteSavedResult - invalid result id ('0')
[12:24:00] [DEBUG] mysql_format - connection: 0, len: 128, format: "INSERT INTO `vehicles` (`Owned`, `Locked`, `Forsale`, `Team`, `Color`,`Color2`, `X`, `Y`, `Z`, `FAngle`, `Price`, `Model`) VALUE..."
[12:24:00] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[12:24:00] [DEBUG] mysql_tquery - connection: 0, query: "", callback: "(null)", format: "(null)"
[12:24:00] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
[12:24:04] [DEBUG] mysql_format - connection: 0, len: 128, format: "SELECT vID FROM vehicles"
[12:24:04] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[12:24:05] [DEBUG] mysql_query - connection: 0, query: "", use_cache: true
[12:24:05] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[12:24:05] [DEBUG] cache_get_row_count - connection: 1
[12:24:05] [WARNING] cache_get_row_count - no active cache
[12:24:05] [DEBUG] cache_delete - cache_id: 0, connection: 1
[12:24:05] [WARNING] CMySQLHandle::DeleteSavedResult - invalid result id ('0')
[12:24:05] [DEBUG] mysql_format - connection: 0, len: 128, format: "INSERT INTO `vehicles` (`Owned`, `Locked`, `Forsale`, `Team`, `Color`,`Color2`, `X`, `Y`, `Z`, `FAngle`, `Price`, `Model`) VALUE..."
[12:24:05] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[12:24:05] [DEBUG] mysql_tquery - connection: 0, query: "", callback: "(null)", format: "(null)"
[12:24:05] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
Reply


Messages In This Thread
Saving Vehicle(SQL R39) - by Lynn - 18.01.2015, 17:10
Re: Saving Vehicle(SQL R39) - by Ironboy - 18.01.2015, 17:30
Re: Saving Vehicle(SQL R39) - by Lynn - 18.01.2015, 17:45
Re: Saving Vehicle(SQL R39) - by Vince - 18.01.2015, 17:53
Re: Saving Vehicle(SQL R39) - by PowerPC603 - 18.01.2015, 17:56
Re: Saving Vehicle(SQL R39) - by Lynn - 18.01.2015, 18:02

Forum Jump:


Users browsing this thread: 1 Guest(s)