Re: variable within regular expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your response. Yesterday I finally noticed that the submit button for the query was pointing to an older version of the processing script. I've corrected that now, and everything works perfectly.

Thanks to all for your help.

Robbie

Jason Wong wrote:

On Tuesday 08 April 2003 05:30, Robbie Staufer wrote:



Thanks for all your suggestions.  I've tried them all and am still
having no luck.  It may be the combination of how I'm using the
conversion statement and the query statement.  I've been checking
through books and on the web and am not finding much about how to use
REGEXP in a query, where the value of the expression is taken from user
input and stored in a variable.  (I'm thinking it should be exactly as
Ignatius says....)  Here's what I have now;

// user enters a partial expression in the $con form field, and php
converts the
// input to a regular expression before searching the database for
matches



How exactly is this conversion being done? I can't see any conversion.




       //convert $con to regular expression
          // $con = "%$con%";
$query = "SELECT {$field} FROM {$table} WHERE {$variable} REGEXP '{$con}'
";

The results page from this search shows no matches.



I'm assuming you're using MySQL. Does the above query match anything when run from the mysql commandline?





-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Robbie Staufer NCAR/SCD 1850 Table Mesa Dr. Rm. 42 Boulder, CO. 80305 (303) 497-1836



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux