#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    3
    Rep 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?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Washington, USA
    Posts
    52
    Rep Power
    15
    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>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    15
    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. ;-)

Similar Threads

  1. div style="overflow: scroll;"
    By slydero in forum HTML Programming
    Replies: 8
    Last Post: October 26th, 2004, 09:54 AM
  2. could u help me out
    By ANGEL_STEALTH in forum HTML Programming
    Replies: 5
    Last Post: October 1st, 2003, 12:10 AM
  3. Please Look Down Into My Problem
    By ANGEL_STEALTH in forum HTML Programming
    Replies: 0
    Last Post: September 30th, 2003, 05:14 AM
  4. <THEAD> not printing across multiple pages
    By allanmcc in forum HTML Programming
    Replies: 2
    Last Post: September 29th, 2003, 08:47 PM

IMN logo majestic logo threadwatch logo seochat tools logo