Re: variable within regular expression

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

 



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?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
The greatest dangers to liberty lurk in insidious encroachment by men
of zeal, well-meaning but without understanding.
		-- Justice Louis D. Brandeis
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

  Powered by Linux