Answer the question
In order to leave comments, you need to log in
How to update the table of goods in an online store?
Hello. There is an online store on self-written cms (php + mysql + js). Every day, respectively, the number of goods changes, the price may change, and so on. Those. There is a need to update the product table once a day. I get a csv file, which then must be processed and uploaded to the database. My suggestion was that each time you update the product table, do not update it, but first clear all fields, and only then insert the data obtained from the csv file. I was offered not to delete anything, but to compare the existing fields with the newly received data. What is the fastest way you use? In which direction to look, can you advise some library?
Answer the question
In order to leave comments, you need to log in
exactly 2 MySQL
LOAD DATA INFILE commands - into a temporary table, then
INSERT INTO ON DUPLICATE KEY UPDATE into the required one.
if the CSV format is 1-in-1 with a table, you can generally get by with the first one, with the REPLACE parameter
The one that the customer asks for
All methods are fast
Wouldn't use code libraries twenty forty lines would be
My suggestion was that each time you update the product table, do not update it, but first clear all fieldsthereby killing goods with zero balance? Man, this is bad for SEO. There, on ozon.ru, for example, there is a book that has not been published for 10 years and will not be published 100% again, but the book is not removed from the site. Guess why?
can you recommend any libraryshield? here works on 10 lines of code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question