On Mon 2002-12-09 at 09:22:09 -0500, beauford.2003@stripped wrote:
> I am using PHP on my website, but this is certainly a MySQL question.
> > That shouldn't matter, because the real value $var is inserted before
> > the query is send to the MySQL server, where REGEXP of the query is
> > evaluated. If there is a problem, you need to be much more
> > specific. Quote the error message, show the relevant part of your code
> > and so on.
> The real value of $var is not inserted before it is sent to the server.
Why not? What is $var? You called it a variable, and there are no
variables of the form $var in MySQL, but only @var. So I presumed that
you mean a PHP variable by $var. If that is not the case, please be
more specific, as I already asked you. Else, this will become a
If it is the case, PHP will replace $var by its value and send the
modified query to MySQL, without the $ sign. If you have reason to
believe otherwise, please cite an example. But I am repeating myself.
> So the questions still remains, how do I get REGEXP to treat $var as a
> variable and not part of its own syntax.
In order to make $ non-special, you have to escape it by a
backslash. In order to get the backslash to the server, you have also
to escape the backslash. How often depends on your exact statement
(which kind of quotes you use, etc.)
> I have been looking at http://www.mysql.com/doc/en/Regexp.html, but
> it does not cover this.
You are right. This page fails to mention how to handle special
characters at all.