Hello, I came across an error while trying to insert a row into a sqlite database, which the database is named 'loot'. I get an error outputted by sql in rc:
PHP Code:
SQL Error: constraint failed
Here's the sql part of the script:
PHP Code:
function AddToLoot() {
temp.mineral = "SELECT content FROM inventories WHERE rowid="@this.itemm;
temp.account = player.account;
temp.classn = "mineral";
temp.name_en = temp.mineral;
temp.loc = this.level;
temp.x = this.x;
temp.y = this.y;
temp.query = "INSERT INTO loot (account, class, name_en, loc, x, y) VALUES ('"@temp.account@"', '"@temp.classn@"', '"@temp.name_en@"', '"@temp.loc@"', '"@temp.x@"', '"@temp.y@"')";
temp.requestObject = requestsql(temp.query, true);
this.waitfor(temp.requestObject, "onReceiveData", 30);
if (temp.requestObject.error) {
echo("SQL Error: " @ temp.requestObject.error);
return;
}
this.chat = temp.requestObject.lastinsertid;
}
Anybody know what I did wrong?