Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

need to search for the a letter in the description


spencermjax

Recommended Posts

Posted

How can I do a search fo a letter. I have part of my description acolor that is the letter D.

I want to find just that letter. Currently when I do a search for D or "D" or " D ", the results will contain any product that has a word that containd the letter D.

 

I only want to return products that contain the word D (or E or F, etc.)

Posted

Yes, it is a color but that really does not matter.

The text is "blah blah blah D blah blah"

or "blah blah blah E blah blah"

or "blah blah blah G blah blah"

 

I want to find the products that contain the D, E or G

 

As it stands ig I have a product that has a model number "qd138" and no "blah blah blah D blah blah" in the description, that product will still be returned because there is a letter d in the model number.

 

This may help:

My search form (don't worry about the looks, I'll clean it up later)

Example of exactly what I want

Posted
Yes, it is a color but that really does not matter.

The text is "blah blah blah D blah blah"

or "blah blah blah E blah blah"

or "blah blah blah G blah blah"

 

I want to find the products that contain the D, E or G

 

As it stands ig I have a product that has a model number "qd138" and no "blah blah blah D blah blah" in the description, that product will still be returned because there is a letter d in the model number.

 

This may help:

My search form (don't worry about the looks, I'll clean it up later)

Example of exactly what I want

 

'select ... from .... where field like % '.$key.' %';

 

instead of :

 

'select ... from .... where field like %'.$key.'%';

Treasurer MFC

Posted
you lost me...

 

in advanced search result you will find like statements in the query construction.

 

that produces query where clasuses like:

 

where model like '%A%'

 

which will fetch anything with an character a in it.

 

if you add a space between the % and the character or phrase on both sides like:

 

where model like '% A %'

 

it will only fetch those with a standalone a

Treasurer MFC

Posted

I will be searching a contribution field (category fields) so the statement may be a bit different but I'll try it. Your explanation is much clearer. I will be able to put it to use on another issue I haven't even mentioned yet. I'll post back soon with my results.

 

Thank You!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...