Jump to content
  • 0
Sign in to follow this  
renssis

Copiar un elemento a otra tabla

Question

Copie un elemento a otra tabla.
Ejemplo: mi copia de búsqueda lleva el elemento a otra tabla

 

when 9005.take begin
            ----"111111222222333333444444555555666666777777888888999999000000"
            say_title("bla bla bla")
            say("")
            local store=select("Save item", "Exit")
            if store==2 then
            return
            end
            mysql_direct_query("select * from player.save_item;")
            mysql_direct_query("INSERT INTO `save_item` (`id`,  `owner_id`,  `window`,  `pos`,  `count`,  `vnum`,  `socket0`,  `socket1`,  `socket2`,  `socket3`,  `socket4`,  `socket5`,  `attrtype0`,  `attrvalue0`,  `attrtype1`,  `attrvalue1`,  `attrtype2`,  `attrvalue2`,  `attrtype3`,  `attrvalue3`,  `attrtype4`,  `attrvalue4`,  `attrtype5`,  `attrvalue5`,  `attrtype6`,  `attrvalue6`) VALUES ('"..pc.get_player_id().."');")
            item.remove()
            setskin(NOWINDO)
        end

quest 2

		when 9005.take with item.get_id() begin
			code = item_attr.set_value()
			codu = item.get_vnum()
			----"111111222222333333444444555555666666777777888888999999000000"
			say_title("bla bla bla")
			say("")
			local store=select("Save item", "Exit")
			if store==2 then
			return
			end
			local code, codu = mysql_direct_query("INSERT INTO save_item_copy1 (id, owner_id, window, pos, count, vnum, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6) SELECT id, owner_id, window, pos, count, vnum, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6 FROM save_item WHERE id LIMIT 1)
			item.remove()
			setskin(NOWINDO)
		end

¿Tienes alguna sugerencia?

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 1
Try:
INSERT INTO save_item_copy1
SELECT * FROM player.save_item WHERE id = id_item;
mysql_direct_query("INSERT INTO save_item_copy1 SELECT * FROM player.save_item WHERE id = "..item.get_id()..";")

Source: 

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

Share this post


Link to post
Share on other sites
  • 1
En 30/10/2019 a las 21:14, renssis dijo:

Not work =/

		when 9005.take begin
			----"111111222222333333444444555555666666777777888888999999000000"
			say_title("bla bla bla")
			say("")
			local store=select("Save item", "Exit")
			if store==2 then
			return
			end
			mysql_direct_query("INSERT INTO save_item_copy1 SELECT * FROM player.save_item WHERE id = "..item.get_id()..";")
			item.remove()
			setskin(NOWINDO)
		end

 

image.png

Source: 

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

 

Remove "setskin(NOWINDO)" 
Those avoid say, select, etc.

Also, is "NOWINDOW"
"setskin(NOWINDOW)" is equals to "setskin(0)" 

 

Try make the only query and check if works
 

Share this post


Link to post
Share on other sites
  • 0
hace 22 horas, caanmasu dijo:
Try:
INSERT INTO save_item_copy1
SELECT * FROM player.save_item WHERE id = id_item;
mysql_direct_query("INSERT INTO save_item_copy1 SELECT * FROM player.save_item WHERE id = "..item.get_id()..";")

Source: 

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

Not work =/

		when 9005.take begin
			----"111111222222333333444444555555666666777777888888999999000000"
			say_title("bla bla bla")
			say("")
			local store=select("Save item", "Exit")
			if store==2 then
			return
			end
			mysql_direct_query("INSERT INTO save_item_copy1 SELECT * FROM player.save_item WHERE id = "..item.get_id()..";")
			item.remove()
			setskin(NOWINDO)
		end

 

Share this post


Link to post
Share on other sites
  • 0

thanks Camilo

 

when 9005.take begin
			----"111111222222333333444444555555666666777777888888999999000000"
			say_title("bla bla bla2")
			say("")
			local store=select("Save item", "Exit")
			if store==2 then
				return
			end
			mysql_direct_query("INSERT INTO save_item SELECT * FROM player.item WHERE id = "..item.get_id()..";")
			item.remove()
		end

 

Share this post


Link to post
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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...