NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page How to do MySQL update

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-23-2006, 05:10 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
ridesign1's Avatar
Join Date: Mar 2005
Posts: 867
ridesign1 has a spectacular aura aboutridesign1 has a spectacular aura about
 



Question How to do MySQL update


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.
????: NamePros.com http://www.namepros.com/programming/230694-how-to-do-mysql-update.html

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
ridesign1 is offline  
Old 08-23-2006, 11:36 AM   #2 (permalink)
NamePros Regular
 
baxter's Avatar
Join Date: Apr 2006
Posts: 363
baxter is just really nicebaxter is just really nicebaxter is just really nicebaxter is just really nice
 


Ethan Allen Fund Save The Children
Originally Posted by ridesign1
INSERT query:
????: NamePros.com http://www.namepros.com/showthread.php?t=230694

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
baxter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:23 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger