Just use: UPDATE table SET fld1= 'foobar' WHERE some-condition
or RTM... =) .bobo ----- Original Message ----- From: "Ross Honniball" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 11, 2004 12:40 PM Subject: [PHP-WIN] Replacing field values in MySQL - is there an easy way? > This is really a mySQL question, not a php question. > > Say you just want to up-date (ie. REPLACE) the value of just one field > within a mysql record with many fields. > > Is there a way to do it without tediously re-setting all the existing field > values? > > eg. > > You have a table with: > > fld-name fld-value > ------------------- > fld1 abc (PRIMARY KEY) > fld2 def > fld3 xzy > fld4 whatever > > and you just want to change say fld4 to 'something else'. > > The only way I can see to do it is by tediously setting up a query like: > > REPLACE INTO table SET fld1='abc', fld2='def', fld3='xyz', fld4='something > else' > > if you try and say : > > REPLACE INTO table SET fld1='abc', fld4='something else' > > it sets fld2 and fld3 to null :-(. > > Anyone know an easy way to get mysql to retain non-key values not > explicitly set in a replace call? > > . Ross Honniball JCU Bookshop Cairns Supervisor > . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia > . Ph:07.4042.1157 Fx:07.4042.1158 Em:[EMAIL PROTECTED] > . There are no problems. Only solutions. > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php