Forum Moderators: open

Message Too Old, No Replies

MySQL/PHP remove text in field

         

texasguy

5:04 pm on Mar 20, 2009 (gmt 0)

10+ Year Member



I am working with MySQL and PHP.

I have a value stored in a field. The value is:
Water Meter Installation (BH-8950.9500-900)

When I show this in a query on a page, I only want it to show Water Meter Installation. I do not want the (BH-8950.9500-900) to show.

Any ideas on how I can accomplish this? I can't use anything related to a set number of characters, because it changes.

Any help is appreciated!

coopster

1:21 pm on Mar 21, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could use a combination of SUBSTRING and POSITION to locate the opening parenthesis in your SQL statement and truncate it. Or you can use regular expression matching to find and replace the text in your server-side scripting language.