MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 24th, 2000, 03:41 PM
Richard Diggler Richard Diggler is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 3 Richard Diggler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have a table and I'd like to alter the contens of an existing row. How would I change a spasific column entry?

Reply With Quote
  #2  
Old August 24th, 2000, 11:49 PM
TDavid TDavid is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Washington, USA
Posts: 52 TDavid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Use sql UPDATE like this:

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
UPDATE tablename SET columname=value WHERE ID=value
[/code]

You won't want to forget the WHERE statement with some type of unique identifier for the data or you'll update EVERY row in the table


------------------
<UL TYPE=SQUARE>
<LI> TD Scripts
<LI> Script School
<LI>php-scripts
</UL>

Reply With Quote
  #3  
Old August 25th, 2000, 03:26 AM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Adding on to TDavid's suggestion, prior to doing your update you may want to do:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
SELECT columname FROM tablename WHERE id=value
[/code]
first. That'll give you the rows that you'll be updating when you execute the UPDATE statement (so long as the DB doesn't change between the SELECT and UPDATE). If you get more than one row back, be careful. ;-)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Altering row content


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT