variable within regular expression

From: Date: Fri, 04 Apr 2003 23:59:06 +0000
Subject: variable within regular expression
Groups: php.db 
Request: Send a blank email to php-db+get-26843@lists.php.net to get a copy of this message
Hi, This is the first time I've written to this list. If I'm not following accepted procedure, please let me know. I have a php query form in which the user input must be converted to a regular expression before querying the db. Something like this pseudo code:
        $var = $_GET['usr-input'];
        $var = '%$var%';
SELECT * FROM table WHERE field LIKE $var. I can't find the right syntax to make this work. Does anyone know? Thanks, Robbie Staufer -- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Robbie Staufer NCAR/SCD 1850 Table Mesa Dr. Rm. 42 Boulder, CO. 80305 (303) 497-1836

« previous php.db (#26843) next »