Click to See Complete Forum and Search --> : Help - Select by field length


plea
11-19-2007, 04:59 PM
Ive got a script to report on domains with three options.
Domain hlq
without numbers
without hyphens

Im trying to add the last option - to select by size
How would I select by size with all the options being optional.
[^0-9-]+\\.co\\uk$


PHP script that builds SQL for report

$sql = "\\\.uk$";
if($_REQUEST['s']{1} == "1") { $sql = "co".$sql; }
if($_REQUEST['s']{2} == "1") { if($_REQUEST['s']{3} == "1") { $sql = "^[^0-9-]+".$sql; }}
if($_REQUEST['s']{2} != "1") { if($_REQUEST['s']{3} == "1") { $sql = "^[^-]+".$sql; }}
if($_REQUEST['s']{2} == "1") { if($_REQUEST['s']{3} != "1") { $sql = "^[^0-9]+".$sql; }}
if(strlen($_REQUEST['s']) != "4") { $sql = "\\\.uk$"; }

$result = mysql_query("SELECT * FROM `tbl` WHERE `domain` REGEXP CONVERT(_utf8 '$sql' USING latin1) COLLATE latin1_swedish_ci ORDER BY `dt` DESC LIMIT 20");



Any help please!

plea
11-20-2007, 06:12 AM
I couldnt find post EDIT


Please ignore this is fixed