SQLite: Error 19 - constraint failed
#1

Hey SA:MP Forum,
I've researched this problem on multiple search engines and cannot find a solution that works. I'm attempting to run a simple query. Which is below:

PHP код:
INSERT INTO `accounts` (`username`, `password`, `ipaddress`) VALUES('a''b''c'); 
In return I receive a error
Quote:

[Err] 19 - constraint failed

Below is the SQL structure.

Quote:
Originally Posted by Structure Name; Structure Type; Structure Length
SQLID INTEGER 0
username TEXT 24
password TEXT 130
ipaddress TEXT 16
Reply
#2

What is the exact query you used to create the table? You are not using foreign keys or check constraints, correct?

I have a feeling those numeric values you have for "structure length" may be tripping you up. It may be an error with primary key also, but without more information I'm just guessing.
Reply
#3

you don't use ; in SQL, and you need a WHERE x='y'
Reply
#4

Quote:
Originally Posted by cessil
Посмотреть сообщение
you don't use ; in SQL, and you need a WHERE x='y'
Yes you can. Research SQL statements.
Reply
#5

oh ok then in that case you're missing the SQLID
Reply
#6

Quote:
Originally Posted by cessil
Посмотреть сообщение
oh ok then in that case you're missing the SQLID
SQLID is already in the structure as you can see from the post. Also, you don't need to insert a SQLID in a query when the structure is a auto-increment.
Reply
#7

ok then start debugging it try different things like
pawn Код:
INSERT INTO `accounts` (`username`, `password`) VALUES('a', 'b');
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)