Page 1 of 1

Omit characters from mysql query using php code

Posted: Tue Aug 14, 2007 7:27 am
by yoda69
Hi,

Lets say I sent a query and got a string for a specific field.

Code: Select all

Select master_name From Teachings
result:

a%

Is it possible to drop the % sign somehow using php before i echo the output?

tnx

Posted: Tue Aug 14, 2007 8:12 am
by superdezign
Of course.

Take a look at str_replace().

Posted: Tue Aug 14, 2007 8:20 am
by miro_igov
Or better trim(), rtrim(), ltrim(). str_replace() will replace any % char in the string, but looks you want only the sufix %