NameSilo

How to do MySQL update

Spaceship Spaceship
Watch

ridesign1

Established Member
Impact
7
Hi,
I currently have a table products which has product id as primary key,
I have a Product model field which is currently blank, I want to update this to a number so it is unique as well.

I have exported the table and I have got INSERT code for the table how do I change this to be an UPDATE query:

INSERT query:

INSERT INTO `products` VALUES (170,2, '9', 'l/body37063s.jpg', 'l/body37063.jpg', 'l/body37063l.jpg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,5.99, '2005-08-02 20:49:46', '2006-07-11 19:38:02', NULL,0,1,0,15, 0);

The first 3 field are:
products_id products_quantity products_model
so 170 is the product id, quantity is 2 and model number is 9
the other fields are just what I got when I exported the table in phpmyadmin, which are present in the table.

Do I change the INSERT to just UPDATE?

thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
ridesign1 said:
INSERT query:

INSERT INTO `products` VALUES (170,2, '9', 'l/body37063s.jpg', 'l/body37063.jpg', 'l/body37063l.jpg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,5.99, '2005-08-02 20:49:46', '2006-07-11 19:38:02', NULL,0,1,0,15, 0);

The first 3 field are:
products_id products_quantity products_model
so 170 is the product id, quantity is 2 and model number is 9
the other fields are just what I got when I exported the table in phpmyadmin, which are present in the table.

The update syntax would be

UPDATE products SET products_quantity = 2, products_model = 9, etc... WHERE products_id = 170

Hope that helps
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back