Jump to content


Photo

Problems with mysql syntax for replacing values


  • Please log in to reply
4 replies to this topic

#1 authenticgeek

authenticgeek
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 06 June 2003 - 04:07 AM

I have a few rows with some data in them and I want to replace single values within these rows.
I\'m stuck on how to do it though.

Any suggestions?

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 06 June 2003 - 07:30 AM

Are u looking for something like this

SELECT REPLACE(\'phpfreak\', \'php\', \'mysql\') where cust_id=2;

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 authenticgeek

authenticgeek
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 06 June 2003 - 04:10 PM

Ok. Here\'s what I tried again that doesn\'t work:

SELECT FROM student REPLACE(namel) WHERE idnum=4123 VALUES (Do);


#4 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 06 June 2003 - 05:44 PM

:idea: :arrow: REPLACE takes 3 values as arguments
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#5 authenticgeek

authenticgeek
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 06 June 2003 - 06:25 PM

Actually, the UPDATE command was what I was looking for.

UPDATE table_name SET column_name=updated_value WHERE value=yourvalue;

Thanks anyways




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users