Jump to content

Recommended Posts

I have a setup where users can store 'templates' in a table. When they add new products, they can apply these templates to the new product - basically it pre-fills fields in the product form.

 

For example, they can store a template with a name of 'red tomato', and if they create a new product called 'red tomato', then the system will automatically find the rule, and apply the template.

 

At the moment, this is super simple, and performed via a query as follows:

 

SELECT * FROM (`templates`) WHERE `rule` like '%red tomato%' LIMIT 1

 

I'd like to take this to the next step, and give users more flexibility in how the search is performed. For example, I'd like to allow users to save wildcards with their template rules. So, they could create a template rule called '*tomato' and this would match any of the following search terms: 'tomato', 'red tomato' or 'green tomato'.

 

Do I need to be careful with the wildcards that are allowed (reserved or special chars ?).

 

Any other general concerns or comments would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/265510-searching-records-with-mysql/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.