hey
i want to select certain records from my database using regexp now i know how to do this normally, however in this circumstance i do not.
what i want to do is select a field where the begining of it is decided by the user (using $_GET) and the first letter of the next bit is also decided by the user
so to select all records starting with the letter 'f' in the category 'cs' the sql would look for fields begining with cs_f
which could be easily interpreted as
$sql = "SELECT * FROM table WHERE name LIKE 'cs_f%'";
however this would not work for numbers
so instead i tried using
<?
$uc = strtoupper($alpha[$i]); // LETTER OF ALPHABET (OR NUMBER)
$type = $_GET['type']."_"; // CATEGORY
$sql = "SELECT * FROM table WHERE name REGEXP '$type^[$uc].*'";
?>
when i echo the sql it shows
SELECT FROM table WHERE name REGEXP 'cs_[f].'
but does not display any records (using mysql_num_rows also shows 0)
any ideas?