This is my first time needing to use a regular expression in an MySQL statement. The following example is a WordPress database interaction. The focus though should be on the use of the regular expression in the query.
Here’s my attempt:
[code=php]
<?php
global $wpdb;
$rows = $wpdb->get_row(“SELECT * FROM $wpdb->bp_activity WHERE action REGEXP ‘(.*)^(http://sociallyaffluent.com/21andolder)(.*)$’ “, ARRAY_N);
if (isset($rows)) { echo ‘its set’; } else { echo ‘not set’; }
?>
There’s nothing wrong with the rest of the code. It’s the regular expression. I’m feeling that this isn’t the proper way to use regexp in SQL statements. Any advice?