Jump to content


Photo

*SOLVED* add an * to all single word search


  • Please log in to reply
2 replies to this topic

#1 prefix

prefix
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 April 2006 - 10:26 AM

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.


#2 KrisNz

KrisNz
  • Members
  • PipPipPip
  • Advanced Member
  • 271 posts
  • LocationAuckland, New Zealand

Posted 14 April 2006 - 11:14 AM

[!--quoteo(post=364744:date=Apr 14 2006, 08:26 PM:name=prefix)--][div class=\'quotetop\']QUOTE(prefix @ Apr 14 2006, 08:26 PM) View Post[/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

#3 prefix

prefix
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 April 2006 - 02:47 PM

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

The '!' means not
[/quote]


Thank you

! did the trick




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users