List:General Discussion« Previous MessageNext Message »
From:Andy Bakun Date:December 9 2002 8:08pm
Subject:Re: Select * From table where name Like 'help'; Help
View as plain text  
You still have not mentioned what language you are using to interface
with MySQL.  If you are using PHP or Perl, then things like single and
double quotes will make a difference here, and looking in the MySQL
manual will not help you.  Check the string that contains the query, if
it looks like this:

   $q = 'select xxxx from table where col regexp "$var"';

change it to

   $q = "select xxxx from table where col regexp '$var'";

The enclosing single quotes are keeping the value of $var from being
interpolated into the string in the above example.  See the manual for
your programming language for more information on variable
interpolation.

On Mon, 2002-12-09 at 08:22, Beauford.2003 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.
> REGEXP thinks that 'var' is part of the search pattern because $ is a
> reserved operator for REGEXP. So what gets sent to the server is totally
> different than what I want to be sent. There are no errors because the
> syntax is correct, its just not correct for the search I want it to perform.
> So the questions still remains, how do I get REGEXP to treat $var as a
> variable and not part of its own syntax.
> 
> I have been looking at http://www.mysql.com/doc/en/Regexp.html, but it does
> not cover this.
> 
> ----- Original Message -----
> From: "Benjamin Pflugmann" <benjamin-mysql@stripped>
> To: "Beauford.2003" <beauford.2003@stripped>
> Cc: "Robert Citek" <rwcitek@stripped>; "MySQL List"
> <mysql@stripped>
> Sent: Monday, December 09, 2002 3:30 AM
> Subject: Re: Select * From table where name Like 'help'; Help
> 
> 
> > Hello.
> >
> > On Mon 2002-12-09 at 01:00:33 -0500, beauford.2003@stripped wrote:
> > > I am doing this search from a website,
> >
> > What does that mean? Which scripting language do you use? PHP? This is
> > more a question for your "website" environment than about MySQL.
> >
> > > and from what I can tell there is no way to use a variable
> > > (i.e. $var) with REGEXP as the $ sign has a special meaning to
> > > REGEXP.
> >
> > 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.
> >
> > HTH,
> >
> > Benjamin.
> >
> > --
> > benjamin-mysql@stripped
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <mysql-thread126995@stripped>
> > To unsubscribe, e-mail
> <mysql-unsubscribe-beauford.2003=rogers.com@stripped>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread127023@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-abakun=thwartedefforts.org@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Thread
Select * From table where name Like 'help'; HelpBeauford.20039 Dec
  • Re: Select * From table where name Like 'help'; HelpJocelyn Fournier9 Dec
  • Re: Select * From table where name Like 'help'; HelpRobert Citek9 Dec
    • Re: Select * From table where name Like 'help'; HelpBeauford.20039 Dec
      • Re: Select * From table where name Like 'help'; HelpBenjamin Pflugmann9 Dec
    • Re: Select * From table where name Like 'help'; HelpBeauford.20039 Dec
      • ADO Bulk InsertsMichael She10 Dec
        • RE: ADO Bulk InsertsFernando Grijalba10 Dec
          • RE: ADO Bulk InsertsMichael She10 Dec
            • RE: ADO Bulk InsertsFernando Grijalba10 Dec
              • RE: ADO Bulk InsertsMichael She10 Dec
                • RE: ADO Bulk InsertsFernando Grijalba10 Dec
                  • RE: ADO Bulk InsertsMichael She10 Dec
                    • RE: ADO Bulk InsertsPaul DuBois11 Dec
                      • RE: ADO Bulk InsertsMichael She11 Dec
                        • RE: ADO Bulk Insertsed11 Dec
                        • RE: ADO Bulk InsertsPaul DuBois11 Dec
      • Re: OT Select * From table where name Like 'help'; HelpMichael T. Babcock10 Dec
      • Re: Select * From table where name Like 'help'; HelpAndy Bakun10 Dec
      • Re: Select * From table where name Like 'help'; HelpBenjamin Pflugmann10 Dec
    • Re: Select * From table where name Like 'help'; HelpBeauford.200310 Dec
      • Re: Select * From table where name Like 'help'; HelpAndy Bakun10 Dec
      • Re: Select * From table where name Like 'help'; HelpRobert Citek10 Dec
    • Re: Select * From table where name Like 'help'; HelpBeauford.200310 Dec
  • Re: Select * From table where name Like 'help'; HelpBeauford.20039 Dec
RE: ADO Bulk InsertsAlan R Anderson11 Dec
  • RE: ADO Bulk InsertsMichael She11 Dec