Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-27-2011, 03:58 AM
Ohk4y Ohk4y is offline
Registered User
Ohk4y's Avatar
Join Date: Jun 2011
Posts: 43
Ohk4y is an unknown quantity at this point
Send a message via AIM to Ohk4y
SQL insert help

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 Errorconstraint 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.this.x;
  
temp.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.querytrue);
    
  
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?
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.