|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a table and I'd like to alter the contens of an existing row. How would I change a spasific column entry?
|
|
#2
|
|||
|
|||
|
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> |
|
#3
|
|||
|
|||
|
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. ;-) |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Altering row content |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|