the sql syntax is working via mysql-front but when i try to echo out the results in php, they're all zero. the sql query below finds titles that match the pattern "copy (#) of $survey_title"
outputPHP Code:include ("common_db.inc.php");
$title = "COPY (1) of You in 10 years";
$regex_title = eregi_replace('^(copy \()[0-9]*\) of ','',$title);
echo $regex_title;
$uid = 4;
$SQL = 'SELECT title, title regexp "^(copy \\\\\()[0-9]*(\\\\\) of '.$regex_title.')$" as regex
FROM survey
WHERE rel_uid = '.$uid;
echo "<br>".nl2br($SQL).'<br>';
$result = mysql_query($SQL);
while ($sql_assoc = mysql_fetch_assoc($result))
{
echo $sql_assoc['title'].' | ';
echo $sql_assoc['regex'].'<br>';
}
Code:You in 10 years SELECT title, title regexp "^(copy \()[0-9]*(\) of You in 10 years)$" as regex FROM survey WHERE rel_uid = 4 Title2 | 0 Survey1 (All Options) | 0 survey4 | 0 survey5 | 0 Real Survey | 0 asdf | 0 You in 10 years | 0 copy (1) of You in 10 years | 0 copy (2) of You in 10 years | 0 copy (1) of asdf | 0




Bookmarks