Omit characters from mysql query using php code

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
yoda69
Forum Newbie
Posts: 16
Joined: Wed Jun 20, 2007 10:21 am

Omit characters from mysql query using php code

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Of course.

Take a look at str_replace().
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

Or better trim(), rtrim(), ltrim(). str_replace() will replace any % char in the string, but looks you want only the sufix %
Post Reply