View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Filtering recordset using LIKE failing

Thread began 9/04/2009 2:13 pm by Les Crowley | Last modified 9/08/2009 5:39 pm by Les Crowley | 2522 views | 14 replies

Les CrowleyBeta Tester

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.

php:
$_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.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...