Jump to content
  • 0

mvp sql error


VladimirCastro

Question


  • Group:  Members
  • Topic Count:  114
  • Topics Per Day:  0.03
  • Content Count:  298
  • Reputation:   4
  • Joined:  03/13/12
  • Last Seen:  

heres my script.. of mvp i got error it says that db sql error mvp 

 

 

    query_sql "SELECT `name` FROM `mvp` WHERE `char_id`="+getcharid(0)+"",.@name$;


    if ( .@name$ == "" ) { query_sql "INSERT INTO `mvp` (`char_id`,`name`,`kills`,`points`) VALUES (" + getcharid(0) + ",'" + escape_sql(strcharinfo(0)) + "',1,1)"; end; }


    query_sql "UPDATE `mvp` SET `kills` = (`kills` + 1), `points` = (`points` +1) WHERE `char_id`=" + getcharid(0);


    end;
 

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Replace yours lines by this line

query_sql "INSERT INTO `mvp` VALUES (" + getcharid(0) + ",'" + escape_sql( strcharinfo(0) ) + "',1,1) on duplicate key update `kills` = `kills` + 1, `points` = `points` +1";

 

If you still have some error, report it

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  114
  • Topics Per Day:  0.03
  • Content Count:  298
  • Reputation:   4
  • Joined:  03/13/12
  • Last Seen:  

i mean how can i make a sql database with that one?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Like this? if so, add this on your script :D

OnInit:
query_sql "CREATE TABLE IF NOT EXISTS `mvp` (`char_id` INT(11) NOT NULL DEFAULT '0', `name` VARCHAR(30) NOT NULL DEFAULT '', `kills` INT NOT NULL DEFAULT '0', `points` INT NOT NULL DEFAULT '0') ENGINE=MyISAM";
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...