near "%": syntax error: SQLite Error
#1

So I have worked for a good hour on completing a vehicle dealership system for my gamemode and I found stumbled upon an issue that I do not know what went wrong with the query itself. Help would be appreciated.

Код:
INSERT INTO vehicles (vID, vModelID, vOwner, vPosX, vPosY, vPosZ, vPosA, vPlates, vColor1, vColor2, vInterior, vWorld, vValue, vLock, vAlarm) VALUES (%d, %d, %d, %f, %f, %f, %f, '%s', %d, %d, %d, %d, %d, %d, %d)
It results in an error with the percentage sign and I don't really know why.
Reply
#2

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
So I have worked for a good hour on completing a vehicle dealership system for my gamemode and I found stumbled upon an issue that I do not know what went wrong with the query itself. Help would be appreciated.

Код:
INSERT INTO vehicles (vID, vModelID, vOwner, vPosX, vPosY, vPosZ, vPosA, vPlates, vColor1, vColor2, vInterior, vWorld, vValue, vLock, vAlarm) VALUES (%d, %d, %d, %f, %f, %f, %f, '%s', %d, %d, %d, %d, %d, %d, %d)
It results in an error with the percentage sign and I don't really know why.
Some of your column names contain keywords: vInterior. It's not allowed: http://www.sqlite.org/lang_keywords.html

I believe you can wrap them in grave accents (`) and they will be recognized as identifiers.

EG,
Код:
INSERT INTO vehicles (..., `vInterior`, ...
Reply
#3

PHP код:
INSERT INTO vehicles (`vID`,`vModelID`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`, `vPlates`, `vColor1`, `vColor2`, `vInterior`, `vWorld`, `vValue`, `vLock`, `vAlarm`) VALUES (`%d`, `%d`, `%d`, `%f`, `%f`, `%f`, `%f`, `%s`, `%d`, `%d`, `%d`, `%d`, `%d`, `%d`, `%d`) 
Reply
#4

I end up with this error
Код:
datatype mismatch: INSERT INTO vehicles (`vID`,`vModelID`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`, `vPlates`, `vColor1`, `vColor2`, `vInterior`, `vWorld`, `vValue`, `vLock`, `vAlarm`) VALUES ('%d', '%d', '%d', '%f', '%f', '%f', '%f', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d')
Query that was used
pawn Код:
INSERT INTO vehicles (`vID`,`vModelID`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`, `vPlates`, `vColor1`, `vColor2`, `vInterior`, `vWorld`, `vValue`, `vLock`, `vAlarm`) VALUES ('%d', '%d', '%d', '%f', '%f', '%f', '%f', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d')
This issue has something more to it, I tried to isolate vInterior in the query from everything else and it worked with the method you have told me to use but when I put them all together it doesn't.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)