On Mon, 2002-12-09 at 16:10, Beauford.2003 wrote:
> I mentioned in my previous email that I am using PHP, and I have also tried
> putting quotes around $var (many different ways) with no better results.
> REGEXP just gives a syntax error when I do this.
I'm sorry, I did miss the where you said you were using PHP. Just found
it. But I was responding to:
The real value of $var is not inserted before it is sent to the
server. REGEXP thinks that 'var' is part of the search pattern
because $ is a reserved operator for REGEXP.
This is most definitely a quoting issue with your PHP string. If it is
quoted correctly, the MySQL server will never see the string $var
appearing after the keyword REGEXP, so if $ has meaning to a regular
expression wouldn't matter (unless the value of $var contained a $).
I've used REGEXP with (really complex) dynamicly built regular
expressions stored in PHP variables a number of times and have never had
a problem as you've described above.
> Through the suggestion of another list user I have found a way that suits my
> needs using the "where name like binary '$var'". It's jury rigged, but works
> the way I need it to work for the most part.
Don't give up now! A perfect solution can be found! :)