I have products table in mysql DB i want to add files name in 3 diffrent fields I already have product id for this products And i need to add fields only from one product id to another I tried insert into products ('products_image','products_image_med','products_image_lrg') VALUES ('3a_s.jpg','3a_s.jpg','3a_s.jpg'), ('4a_s.jpg','4a_s.jpg','4a_s.jpg'), ('5a_b.jpg','5a_b.jpg','5a_b.jpg'), WHERE products_id >1806 AND products_id < 2642 Not working Thank you Good day
1. Don't bump after only 2 hours 2. Read up on SQL, you are way off The errors you are getting should indicate some problems, such as: - not using backticks for column names - trailing comma at end of list - a 'where' clause in an 'insert' query I think you want to do an 'update' query.
THE PROBLEM HOW DO I UPDATE 1500 ROWS CANT GET IT I HAVE ALLREADY PRODUCT ID SHOW YOU EVEN THAT DOSENT WORK ONE FIELD HOW COME FAILED! - INSERT INTO products ('products_image','products_image_med','products_image_lrg') VALUES ('1a_s.jpg','1a_s.jpg','1a_s.jpg') WHERE products_id =1805 ???
I am not quite sure I understand the problem, but you do need an UPDATE statement instead of an INSERT.
Thank you I have a table called "products" with 1200 products in it some of the products missing images I have all images(file name) by "product id " and i want to insert them into the DB in 3 fields 1. I need to insert by product id so here comes the WHERE WHERE products_id >1806 AND products_id < 2642 2. I need to insert the same file name into 3 fields in the products table ('products_image','products_image_med','products_image_lrg') 3. And file name ('3a_s.jpg','3a_s.jpg','3a_s.jpg'), Thank you for the quick response
Because you're using the WHERE id =, it would be UPDATE, as previously said, not INSERT. When you say WHERE id =, it's assuming there's already an entry in the database that you're wanting to use, which contradicts the INSERT command you used at the start, which implies you want a new entry.
Yes it is going into the products table Each 3images going into one table row Now i need to implent the missing image in about 800 products means 800 rows that ihave the ID of each one of them and the image name for each field Not an easy task