yes, do a backup first :)
SELECT is the first query where you save an array of itemID.
After that you use the INSERT INTO query to set the values in the itemID passed from the array.
remember that 4356 must be an incremental value and itemID must be the value passed from the array of the first query.
B_Dark said:
SELECT itemID FROM jos_k2_items
WHERE catid = 8INSERT INTO jos_k2_tag_xref
VALUES (4356, 12, itemID)
something like this?
Andrea Vigato said:
i'm out of home now, anyway..if you have to update with no erase you will have to save a new field, as i see in the sql any item id that got more than one tag got a reference to more tagID.
So what you just need to do is:
(First Query)
SELECT itemID FROM jos_k2_items
WHERE catid = $catid
$catID = the ID of your category "Cinema"
(Second Query)
INSERT INTO jos_k2_tag_xref
VALUES ($id, $tagID, $itemID)
$id: must to be a incremental number from the last id in jos_k2_tag_xref to counter of the first query, or just an incremental number if you want.
$tagID: is the ID of the tag you want to add, like 8 don't know.
$itemID: with the first query you have saved an array of the itemID you must change. Use it to dinamic change this var.
Some link to use jdb if you need:
api.joomla.org/Joomla-Framework/Database/JDatabase.html
docs.joomla.org/How_to_use_the_database_classes_in_your_script
Hope will be ok :) sorry if it's a bit confusion... B_Dark said:
beacose i dont want to erese the other tagid's of any item of this category i want only to add another one tag only to this items of this category B_Dark said:Is it possible with this SQL query to erase the other tags of any item of this category ?! Andrea Vigato said:yes you can, but not in an easy way :) you have to create a SQL query and modify the DB.
Something like:
SELECT itemID FROM jos_K2_item WHERE catid = (the id of your category)
and then an UPDATE in those itemID to set tagID = your tag ID.
B_Dark said:
so we can't add a specifc tag in all items of present right now in a spesific category? Andrea Vigato said:because what i know of K2 tag system is that the tag is related to the item, not the category.
tagID -> itemID -> catID
So you cannot just add a tag ID to the category, you have to check the category you want if it's related to the item then add a reference of the tag you want...maybe after work i'll write you some code ok? B_Dark said:
ok the one column tagID is the one of column part order to find the solution, the other one column itemID is for one specific item id, right? so, i don't understood how with itemID i have a solution for mass add tag "trailer" in 600 item that i have save in my category "cinema'?! sorry if i make rowng but really i don't understood how this column (itemID) is my solution Andrea Vigato said:no,
id (id related to the entry of the jos_k2_tags_xref)
tagID (id of the related Tag)
itemID (id of the related Item)
you have to use tagID and itemID, id it's not important for your question....