Filtering recordset using LIKE failing
I've worked out how to get a checkbox group saved to the db into a single field.
The values in the field are: Seascapes Elvis ZZ Top
This is my recordset and it's using galselect as the parameter that contains the above values.
$_GET['galselect'] = $row_companyid['gallerycategories'];
$colname_prodcats_retail = "-1";
if (isset($_GET['galselect'])) {
$colname_prodcats_retail = (get_magic_quotes_gpc()) ? $_GET['galselect'] : addslashes($_GET['galselect']);
}
mysql_select_db($database_rockncom, $rockncom);
$query_prodcats_retail = sprintf("SELECT DISTINCT Category FROM products WHERE Category LIKE %s ORDER BY Category ASC", GetSQLValueString($colname_prodcats_retail . "%", "text"));
$prodcats_retail = mysql_query($query_prodcats_retail, $rockncom) or die(mysql_error());
$row_prodcats_retail = mysql_fetch_assoc($prodcats_retail);
The problem I'm having is that if there is a single value (such as Seascapes) it will return Seascapes from the recordset - it won't return any results if there are multiple words (such as Seascapes Elvis ZZ Top).
Am I missing something in the way the conditional LIKE works?
Any help is greatly appreciated.