At 05:10 PM 12/9/2002 -0500, Beauford.2003 wrote: >I mentioned in my previous email that I am using PHP, and I have also tried >putting quotes around $var (many different ways) with no better results. >REGEXP just gives a syntax error when I do this.
Below is an example of using PHP and MySQL with a REGEXP condition. It's a variation on an example from Chapter 4 of "Web Database Applications with PHP & MySQL" by Hugh E. Williams and David Lane, O'Reilly, 1st Ed., 2002. Regards, - Robert ----- <html> <head> <title>PHP and MySQL with Regexp</title> </head> <body> <pre> <?php $connection = mysql_connect("host","username","password"); mysql_select_db("database_name", $connection); $var="[[:<:]]One[[:>:]]"; $sql="select 'Any One' regexp \"" . $var . "\""; echo $sql . "\n"; $result = mysql_query("$sql", $connection); while( $row = mysql_fetch_row($result)) { echo "|"; for ($i=0; $i<mysql_num_fields($result); $i++) echo " " . $row[$i] . " |" ; echo "\n"; } mysql_close($connection); ?> </pre> </body> <html> --------------------------------------------------------------------- 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 <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php