Answer the question
In order to leave comments, you need to log in
Sending sql query and sql logs, how to insert everything?
Good afternoon, I am studying and doing parsing for myself (training).
I want to make it send a request to the database, but it doesn't work.
When adding a product to the site, there are requests:
FROM s_products AS p
LEFT JOIN s_lang_products l ON l.product_id=p.id AND l.lang_id = 1
WHERE
1
AND p.url = 'nazvanie'
GROUP BY p.id
LIMIT 1
SHOW TABLES LIKE '%s_languages%'
SELECT DISTINCT
p.id,
p.url,
p.brand_id,
p.position,
p.created as created,
p.visible,
p.featured,
p.rating,
p.votes,
p.last_modify,
l.name, l.meta_title, l.meta_keywords, l.meta_description, l.annotation, l.body, l.special
FROM s_products AS p
LEFT JOIN s_lang_products l ON l.product_id=p.id AND l.lang_id = 1
WHERE
1
AND p.url = 'nazvanie'
GROUP BY p.id
LIMIT 1
INSERT INTO s_products SET id='0', name='Название', visible='1', featured=NULL, brand_id='0', url='nazvanie', meta_title='Title', meta_keywords='Keywords', meta_description='Description', annotation='', body='', rating='0', votes='0', last_modify='2018-02-20 19:20:01'
UPDATE s_products SET position=id WHERE id=2888
SELECT count(*) as count FROM s_lang_products WHERE lang_id='1' AND product_id=2888 LIMIT 1
INSERT INTO s_lang_products SET name='Название', meta_title='Title', meta_keywords='Keywords', meta_description='Description', annotation='', body='', lang_id='1', product_id='2888'
SHOW TABLES LIKE '%s_languages%'
SELECT DISTINCT
p.id,
p.url,
p.brand_id,
p.position,
p.created as created,
p.visible,
p.featured,
p.rating,
p.votes,
p.last_modify,
l.name, l.meta_title, l.meta_keywords, l.meta_description, l.annotation, l.body, l.special
FROM s_products AS p
LEFT JOIN s_lang_products l ON l.product_id=p.id AND l.lang_id = 1
WHERE 1 AND p.id = 2888 GROUP BY p.id
LIMIT 1
select category_id from s_products_categories where product_id='2888'
DELETE FROM s_products_categories WHERE product_id='2888'
update s_categories set last_modify=now() where id=24
INSERT IGNORE INTO s_products_categories SET product_id='2888', category_id='24', position=0
INSERT INTO s_variants SET id='', name='', sku='', price='', currency_id='2', compare_price='', stock=NULL, yandex='0', product_id='2888'
SELECT count(*) as count FROM s_lang_variants WHERE lang_id='1' AND variant_id=2858 LIMIT 1
INSERT INTO s_lang_variants SET name='', lang_id='1', variant_id='2858'
SELECT count(*) as count FROM s_lang_variants WHERE lang_id='2' AND variant_id=2858 LIMIT 1
INSERT INTO s_lang_variants SET name='', lang_id='2', variant_id='2858'
SELECT count(*) as count FROM s_lang_variants WHERE lang_id='3' AND variant_id=2858 LIMIT 1
INSERT INTO s_lang_variants SET name='', lang_id='3', variant_id='2858'
SHOW TABLES LIKE '%s_languages%'
SELECT
v.id,
v.product_id,
v.price,
NULLIF(v.compare_price, 0) as compare_price,
v.sku,
IFNULL(v.stock, '10') as stock,
(v.stock IS NULL) as infinity,
v.attachment,
v.currency_id,
v.yandex,
c.rate_from,
c.rate_to,
l.name
FROM s_options po
LEFT JOIN s_features f ON f.id=po.feature_id
LEFT JOIN s_lang_features l ON l.feature_id=f.id AND l.lang_id = 1
WHERE
1
AND po.product_id in('2888')
AND po.lang_id=1
ORDER BY f.position
SHOW TABLES LIKE '%s_languages%'
SELECT
f.id,
f.position,
f.in_filter,
f.yandex,
f.auto_name_id,
f.auto_value_id,
f.url,
l.name
INSERT INTO s_products (url,name,brand_id,meta_title,meta_keywords,meta_description)
VALUES ((SELECT MAX(product_id) FROM s_lang_products),'%Название%','0','%Название%','%Название%','%Название%')
ON DUPLICATE KEY UPDATE `url` =
(SELECT MAX(product_id) FROM s_lang_products),
`name` = '%Название%',
`brand_id` = '0',
`meta_title` = '%Название%',
`meta_keywords` = '%Название%',
`meta_description` = '%Название%';
INSERT INTO s_lang_products (lang_id,product_id,name,meta_title,meta_keywords,meta_description)
VALUES ('1',(SELECT MAX(product_id) FROM s_products),%Название%,'%Название%','%Название%','%Название%')
ON DUPLICATE KEY UPDATE `lang_id` = '1',
`product_id` = (SELECT MAX(product_id) FROM s_products),
`name` = '%Название%',
`meta_title` = '%Название%',
`meta_keywords` = '%Название%',
`meta_description` = '%Название%';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question