Answer the question
In order to leave comments, you need to log in
Binding the id (article) of the product to the contentid (image) how?
Good evening, I'm trying to make it so that from 1 table where there is an ID value, it is bound in another table where there is contentid.
Here is the table of the articles themselves. This table is where the article ID should be
assigned
when adding
SELECT modx_site_tmplvar_contentvalues.contentid FROM
modx_site_tmplvar_contentvalues
INNER JOIN
modx_site_content
ON
modx_site_content.id = modx_site_tmplvar_contentvalues.contentid
ORDER BY `contentid` DESC
SELECT LAST_INSERT_ID();
Answer the question
In order to leave comments, you need to log in
If 1 article + 1 picture (you just need to select the desired "tmplvarid")
SELECT * FROM modx_site_content AS msc
LEFT JOIN modx_site_tmplvar_contentvalues AS mstc
ON msc.id = mstc.contentid AND mstc.tmplvarid = 1
ORDER BY mstc.contentid DESC
SELECT * FROM modx_site_tmplvar_contentvalues AS mstc
LEFT JOIN modx_site_content AS msc
ON msc.id = mstc.contentid
ORDER BY mstc.contentid DESC
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question