Jump to content
  • 0

SQL Slots updating


Pavi

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   0
  • Joined:  03/03/12
  • Last Seen:  

Hey guys,Lemme just jump right in,I'm not the best with SQL commands within scripts,and was practicing recently,this is what I was going for....I created a table..

CREATE TABLE IF NOT EXISTS `reward_giver` (
`id` int(11) unsigned NOT NULL auto_increment,
`reward_id` int(11) NOT NULL,
`reward_amount` int(11) NOT NULL,
`reward_zeny` int(11) NOT NULL,
`char_id` int(11) NOT NULL,
`char_name` varchar(255) NOT NULL,
`collected` tinyint(1) NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM ;

And I wanted the max amount of slots to be used is 10.

set @nb,query_sql("INSERT INTO `reward_giver`  VALUES(NULL,'"+ escape_sql(@reward_item) +"','"+ escape_sql(@reward_amount) +"','"+ escape_sql(@zeny_amount) +"','"+ escape_sql(@charid) +"','"+ escape_sql(@name$) +"','"+ escape_sql(@target$) +"','"+ escape_sql(@collected) +"')");
set $@reward_given,$@reward_given+1;

The thing I needed help with was this...after a reward is given,I want the slot to be emptied,and the rest of the slots to move up

So if I had slot 2,and I received I reward i want slot 3 to become slot 2,and slot 4 to become slot 3 so on and so forth.

I'd imagine I'd use the query_sql(UPDATE

command but..I'm not really sure...Thank you in advanced

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...