I want to replace some fields of a row in my table and leave

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aneuryzma
Forum Contributor
Posts: 106
Joined: Sat May 17, 2008 7:03 am

I want to replace some fields of a row in my table and leave

Post by aneuryzma »

I want to replace some fields of a row in my table and leave other fields intact.

$res = mysql_query("REPLACE INTO User VALUES('updatedValue',...,...,'updatedValue2', 'updatedValue3'')");

The values with '...' should not be replaced. What code should I write ?
thanks
genix2011
Forum Commoner
Posts: 74
Joined: Tue Aug 02, 2011 4:00 pm

Re: I want to replace some fields of a row in my table and l

Post by genix2011 »

Hi,

you have to use the MySQL Update command.

Example:

Code: Select all

mysql_query("Update `User` SET `field1` = 'updatedValue1', `field2` = 'updatedValue2' WHERE `ID`=2");
Greets.
Post Reply