Adding spaces to PHP?

Ben

New member
Hi all,

I have a search box which I need to automatically add spaces to so that it can search for extreme exact matches, at the moment even spaces don't bring the required products back. But if I add space in front of the word and after the word it works.

So what I want to do is add these spaces automatically ideally, I have been thinking about it all day but I really don't know where to start.

Any help would be great

Thanks in advance
We are using click cart pro 6 and the search doesn't do as we want, I do find it very difficult to understand the scripting, I am not quite sure where to add any code either. In other words I am very hopeless lol, I would show the code but I don't have enough characters to work with.

Where would I put $variable = " $variable ", sorry to ask but it's been a very long day, I am going to have nightmares about this tonight
 
Is this your own php application? If so, you can simple write:
$variable = " $variable "; in the application and it will add spaces to the front and back (replace $variable with the variable containing your search string, of course).

If this is just something that you're accessing via a web browser, your title is wrong - you don't want to add spaces to php, you want to add spaces to the query string. There are ways to do it, either by writing a wrapper which then calls the search (may not work, depending on if the search knows to prevent outside referrer strings), or you could use greasemonkey to modify the source of the page (which will likely not work).
 
Back
Top