Jump to content

Replace Part of a varchar


Topshed

Recommended Posts

G'day all,

 

MySQL4.0

PHP5

 

I have a few hundred records where I want to replace stuff to the begining of the field and keep the end bit which is differant in every record. and I am trying to do this in phpmyadmin

 

without a wild card it works fine

 

UPDATE food
   SET notes = replace(notes,'Rhubarb Apples and custard Menu 506','Rhubarb Apples Custard and strawberries Menu 506 ')
   WHERE Class LIKE 'Food'

 

Problem is the number at the end changes with every record so the last bit needs to be treated as a wild card to retain that bit of the varchar

 

I have been playing around with this but I cannot come up with the answer, any suggestion s would be most appreaciated

 

Thanks

Roy...

Link to comment
https://forums.phpfreaks.com/topic/141919-replace-part-of-a-varchar/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.