SQLite last_insert_rowid() tag mismatch
#1

Hello I am currectly having an issue with this code:
pawn Код:
new DBResult: Result;

Result = db_query(Database, "SELECT last_insert_rowid()");
                       
LoadVehicle(Result);
                       
db_free_result(Result);
The issue I am having is that it is giving me a tag mismatch on this line:

pawn Код:
Result = db_query(Database, "SELECT last_insert_rowid()");
Can someone please explain what I am doing wrong here please.
Reply
#2

EDIT:
It is infact this line that i get the error on:

pawn Код:
LoadVehicle(Result);
Sorry about that.
Reply
#3

Anyone know what may be causing this?
Reply
#4

Bump
Reply
#5

show LoadVehicle() or try strval(Result) or something
Reply
#6

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
show LoadVehicle() or try strval(Result) or something
strval wouldn't work other than giving a different tag mismatch, here is the LoadVehicle stock:
pawn Код:
stock LoadVehicle(id)
{  
    new
        DBResult: Result,
        Query[256],
        temp[256];
       
    format(Query, sizeof Query, "SELECT * FROM `vehicles` WHERE `id` = %i", id);   
    db_query(Database, Query);
   
    if(db_num_rows(Result))
    {
        db_get_field_assoc(Result, "id", temp, sizeof temp);
        Vehicle[id][vSQLID] = strval(temp);
       
        db_get_field_assoc(Result, "modelid", temp, sizeof temp);
        Vehicle[id][vModel] = strval(temp);
       
        db_get_field_assoc(Result, "pos_x", temp, sizeof temp);
        Vehicle[id][vPos][0] = floatstr(temp);
       
        db_get_field_assoc(Result, "pos_y", temp, sizeof temp);
        Vehicle[id][vPos][1] = floatstr(temp);
       
        db_get_field_assoc(Result, "pos_z", temp, sizeof temp);
        Vehicle[id][vPos][2] = floatstr(temp);
       
        db_get_field_assoc(Result, "pos_r", temp, sizeof temp);
        Vehicle[id][vPos][3] = floatstr(temp);
       
        db_get_field_assoc(Result, "colour1", temp, sizeof temp);
        Vehicle[id][vColour][0] = strval(temp);
       
        db_get_field_assoc(Result, "colour2", temp, sizeof temp);
        Vehicle[id][vColour][1] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_0", temp, sizeof temp);
        Vehicle[id][vMods][0] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_1", temp, sizeof temp);
        Vehicle[id][vMods][1] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_2", temp, sizeof temp);
        Vehicle[id][vMods][2] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_3", temp, sizeof temp);
        Vehicle[id][vMods][3] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_4", temp, sizeof temp);
        Vehicle[id][vMods][4] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_5", temp, sizeof temp);
        Vehicle[id][vMods][5] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_6", temp, sizeof temp);
        Vehicle[id][vMods][6] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_7", temp, sizeof temp);
        Vehicle[id][vMods][7] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_8", temp, sizeof temp);
        Vehicle[id][vMods][8] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_9", temp, sizeof temp);
        Vehicle[id][vMods][9] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_10", temp, sizeof temp);
        Vehicle[id][vMods][10] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_11", temp, sizeof temp);
        Vehicle[id][vMods][11] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_12", temp, sizeof temp);
        Vehicle[id][vMods][12] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_13", temp, sizeof temp);
        Vehicle[id][vMods][13] = strval(temp);
       
        db_get_field_assoc(Result, "fuel", temp, sizeof temp);
        Vehicle[id][vFuel] = strval(temp);
       
        Vehicle[id][vVID] = CreateVehicle(Vehicle[id][vModel], Vehicle[id][vPos][0], Vehicle[id][vPos][1], Vehicle[id][vPos][2], Vehicle[id][vPos][3], Vehicle[id][vColour][0], Vehicle[id][vColour][1], -1);
    }
   
    db_free_result(Result);
    return 1;
}
Reply
#7

can u do something like LoadVehicle(_:Result);

i dont know how sqlite works
Reply
#8

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
can u do something like LoadVehicle(_:Result);

i dont know how sqlite works
What would that achieve? Also thanks for the suggestions so far, it seems like no one uses SQLite haha.
Reply
#9

that should get rid of the error... try it
Reply
#10

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
that should get rid of the error... try it
Nope still points to the same line and the same tag-mismatch, thanks anyways.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)