SQLite problem [SOLVED] -
Firzendxiw - 08.06.2012
Well for the last 2 hours it seems i've been hitting my head against a brick wall. I just can't seem to get the table to store the data.
I check the values with printf(...) #DEBUGGING# and they show up correct. After everything is supposibly loaded into the Database, I check the Database using a SQLite Browser.
The first table I created stores the data fine, but when it comes to the table I'm trying to store the data in. It just shows the columns with nothing entered.
Here is the SQLite code, I just can't workout where it's going wrong...(Gonna be annoying if its something simple
)
pawn Код:
format(Query, sizeof(Query), "INSERT INTO `%d` (`itemid`,`entityid`,`modelid`,`x`,`y`,`z`,`rx`,`ry`,`rz`,`angle`,`colour1`,`colour2`) VALUES('Object','%d','%d','%f','%f','%f','%f','%f','%f','0','0','0')",id,count,modelid,x,y,z,rx,ry,rz);
Result = db_query(MapDatabase, Query);
db_free_result(Result);
Hopefully what I'm asking made sense to you all.
Re: SQLite problem -
Vince - 08.06.2012
Uh? Are you creating a whole TABLE for each object?
Re: SQLite problem -
Firzendxiw - 08.06.2012
No, I don't think I should be, id is a number that runs throughout the whole script. Everything works until I reach this part. %d id is just the same number basically.
Re: SQLite problem -
MadeMan - 08.06.2012
Can you print the 'Query' to server log (after format) and show the result?
Also, would be good if you show your table structure.
Re: SQLite problem -
Firzendxiw - 08.06.2012
[03:53:11] INSERT INTO `4` VALUES('Object','39','2060','-1423.232177','503.596618','17.961086','0.000000',' 0.000000','279.965087','0','0','0')
[03:53:11] Object 175 saved into database
[03:53:11] ModelID 2060, InteriorID 0, WorldID 0, PosX -1423.535156, PosY 504.627136, PosZ 17.986085, PosRX 0.000000, PosRY 0.000000, PosRZ 289.964599
[03:53:11] Object 177 loaded into slot 39
[03:53:11] INSERT INTO `4` VALUES('Object','40','2060','-1423.535156','504.627136','17.986085','0.000000',' 0.000000','289.964599','0','0','0')
[03:53:11] Object 177 saved into database
Here are 2 values, the INSERT INTO is the query. The ModelID = "" is the printf to debug this
Re: SQLite problem [SOLVED] -
Firzendxiw - 08.06.2012
Discovered the problem, apparently SQLite doesn't like when it has a number for tables. Idk if this is correct but its working now for me
Thank you everyone that assisted me in this!