GetDotted Domains

Viewing Thread:
"PHP error - one for the php experts."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 14/03/05 at 15:30
Moderator
"Are you sure?"
Posts: 5,000
I'm sure one of you PHP wizards will be able to help - I can only just about cut + paste PHP so I'm struggling!

I'm using some PHP code from CJ Webdesign for a simple website Search Engine.
I've got everything working but when I try searching for word + another the '+' symbol creates loads of errors (so does *).

The errors are reported in line 38 (preg_match)

You can see the script errors at [URL]http://www.hmmm.ip3.co.uk/search/[/URL]
Search for: freeola test then freeola + test

Thanks in advance - code here: (freeola forum police stop the long fields being posted [URL]http://www.hmmm.ip3.co.uk/cgi-bin/axs/ax.pl?http://www.hmmm.ip3.co.uk/search/code.shtml[/URL]
Mon 14/03/05 at 16:01
Regular
"Devil in disguise"
Posts: 3,151
Only had a brief look, but I'm guessing the problem is this...

Your search string is "freeola + test", the script splits this up into 3 separate strings, "freeola", "+", "test". Each string then gets fed into preg_match. The problem comes with the "+" string. + is a special character in regular expressions it means repeat 1 or more times. So you've got a regular expression /\b+\b/i except theres nothing to repeat as theres no other normal characters in there. What you actually need to do is escape regular expression special characters, ie + becomes \+ and so on.
Alternatively, cheap fix, on the next line after foreach (before the preg_match statements) put
if (strlen($word<= 1){ continue; }
As you're probably not going to be interested in matching characters of 1 or less anyway.
Mon 14/03/05 at 15:30
Moderator
"Are you sure?"
Posts: 5,000
I'm sure one of you PHP wizards will be able to help - I can only just about cut + paste PHP so I'm struggling!

I'm using some PHP code from CJ Webdesign for a simple website Search Engine.
I've got everything working but when I try searching for word + another the '+' symbol creates loads of errors (so does *).

The errors are reported in line 38 (preg_match)

You can see the script errors at [URL]http://www.hmmm.ip3.co.uk/search/[/URL]
Search for: freeola test then freeola + test

Thanks in advance - code here: (freeola forum police stop the long fields being posted [URL]http://www.hmmm.ip3.co.uk/cgi-bin/axs/ax.pl?http://www.hmmm.ip3.co.uk/search/code.shtml[/URL]

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Simple, yet effective...
This is perfect, so simple yet effective, couldnt believe that I could build a web site, have alrealdy recommended you to friends. Brilliant.
Con
LOVE it....
You have made it so easy to build & host a website!!!
Gemma

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.