Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7888477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:50:28+00:00 2026-06-03T05:50:28+00:00

I have a PHP/mySQL search script that for some reason, after the latest update

  • 0

I have a PHP/mySQL search script that for some reason, after the latest update by the developer, has stopped working when searching with wildcards (*). What’s worse, it not only stopped working, but it returns the following nasty (for visitors) mySQL error, which is based on a donut wildcard search:

SELECT a.product_id, a.category_id FROM products a
LEFT JOIN users u ON u.userid=a.ownerid
WHERE a.active=1 AND a.approved=1 AND a.deleted=0 AND a.creation_in_progress=0
AND a.name LIKE '%%' 
AND ((a.name REGEXP '( )*(*donut*)( )*') OR (a.description REGEXP '( )*(*donut*)( )*'))

The error:

Mysql Error: Got error 'repetition-operator operand invalid' from regexp

Unfortunately, the developer can’t (or won’t) fix it and it’s rendering my website useless if someone does a wildcard search.

Any ideas what the problem could be? Or an easy fix? I already tried putting a backslash before the $keywords_search but that didn’t work. I also tried running the above mySQL query directly in PhpMyAdmin and it produced the same error.

I also tried to completely get rid of the REGEXP part but then it won’t return any results at all.

The PHP search code of this part is as follows:

$query[] = "((a.name REGEXP '( )*(" . str_replace(' ', ')*( )*(', $keywords_search) . ")( )*') 
OR (a.description REGEXP '( )*(" . str_replace(' ', ')*( )*(', $keywords_search) . ")( )*'))";      
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:50:30+00:00Added an answer on June 3, 2026 at 5:50 am

    You want to escape your stars (*) if you want it to match a literal star. If you want it to translate “any string”, you need to change it to .*. It’s that simple. Just take the user’s input and apply the replacing on it before you query the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP search script that queries a MySQL database and then parses
I have a PHP keyword search script that searches a MySQL database and then
(Using MySQL and PHP) I have a search form that will allow my users
I have a PHP script search script that logs every query made in a
I have a simple php/mysql script that stores in mysql database id, link, and
I have a PHP and jQuery script that creates search result suggestions from a
We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ,
I have a php/mysql poll that I'm trying to modify. It sets a unique
I have a PHP/MySQL query that returns to an HTML table, and I'm stuck
I have a legacy PHP/MySQL app that calls mysql_connect(). Tons of existing downstream code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.