views:

27

answers:

1

HI, I am trying the below code .

 $domain = $_GET['url'];
 $sql = 'SELECT * FROM `domains` WHERE `domain` REGEXP CONVERT(_utf8 \'$url\' USING latin1) COLLATE latin1_swedish_ci';
 $result = mysql_query($sql);

 while($row = mysql_fetch_array($result, MYSQL_NUM))
{
    echo "id :{$row[0]} <br>";

}

will get the domain from user using $_GET and then regex that from database .. This query is not working , please tell me the proper syntax I even tried double quotes \"$domain"\

A: 
$sql = "SELECT * FROM `domains` WHERE `domain` REGEXP CONVERT(_utf8 '".$url."' USING latin1) COLLATE latin1_swedish_ci";
Alexander.Plutov
Thanks, thats working, but it limited the regex capabilities, before I was getting results for say www.google.com , but now only google.com is working and not showing the domain ID for google.com
learningspree