Jump to content

Archived

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

prefix

*SOLVED* add an * to all single word search

Recommended Posts

What I'm trying to do is add an '*' to the end of a single word search string, if an asterixes isn't already there.

I've been trying with if (strstr($searchstring,'*'))

but can't seem to get it to work.

Any help much appreciated.

Share this post


Link to post
Share on other sites
[!--quoteo(post=364744:date=Apr 14 2006, 08:26 PM:name=prefix)--][div class=\'quotetop\']QUOTE(prefix @ Apr 14 2006, 08:26 PM) [snapback]364744[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What I'm trying to do is add an '*' to the end of a single word search string, if an asterixes isn't already there.

I've been trying with if (strstr($searchstring,'*'))

but can't seem to get it to work.

Any help much appreciated.
[/quote]

I think you want if (!strstr($searchstring,'*')) $searchstring .= "*";

The '!' means not

Share this post


Link to post
Share on other sites
[!--quoteo(post=364752:date=Apr 14 2006, 06:14 AM:name=KrisNz)--][div class=\'quotetop\']QUOTE(KrisNz @ Apr 14 2006, 06:14 AM) [snapback]364752[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I think you want if (!strstr($searchstring,'*')) $searchstring .= "*";

The '!' means not
[/quote]


Thank you

! did the trick

Share this post


Link to post
Share on other sites

×

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.