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.
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]
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.
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]