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 7997811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:03:24+00:00 2026-06-04T15:03:24+00:00

I have an SQL LIKE query running on mySQL which runs fine on my

  • 0

I have an SQL LIKE query running on mySQL which runs fine on my local development server however on the production server it only works on single letters; i.e. if I enter a word any longer than one letter it returns no results.

Any ideas why and how I might be able to fix it?

Thank you in advance.

/**
* Searches all current vehicle listings for matches to given search string.
* @param string - Search keyword(s). Warning: If search string is empty all current vehicles are returned.
* @return array - Resulting table rows containing vin, imageFile, description, kms, auctioneerName, city, time.
*/

public function searchVehicles($search) { // 
  // Build up initial SQL query. Sub query returns all current vehicles
  $query = "SELECT * FROM (SELECT vehicles.auctionId, vin, imageFile, CONCAT_WS(' ', year, makeName, modelName) as description, kms, auctioneerName, city, time FROM vehicles, models, makes, auctions, auctioneers, locations WHERE time > NOW() AND vehicles.modelId = models.modelId AND models.makeId = makes.makeId AND vehicles.auctionId = auctions.auctionId AND auctions.auctioneerId = auctioneers.auctioneerId AND auctions.locationId = locations.locationId) AS results WHERE";
  $keywords = explode(" ", $search); // Break search into keywords

  // Loop through each keyword in the search to build up SQL query
  $firstLoop = true; // Initial loop flag
  foreach ($keywords as $keyword) {
     if (!$firstLoop) { // Check if this is not the first loop
        $query = $query . " AND"; // Then: Add extension statement to query
     } else {$firstLoop = false;} // Otherwise: Set flag to false

     // Add each keyword search to the query ensuring case insensitivity by converting to uppercase
     $query = $query . " UPPER(description) LIKE UPPER('%" . $this->escape($keyword) . "%')";
  }

  // Add ordering SQL
  $query = $query . " ORDER BY time";

  // Run query and return results (if any)
  return $this->query($query);
}
  • 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-04T15:03:26+00:00Added an answer on June 4, 2026 at 3:03 pm
    $query = $query . " UPPER(description) LIKE '%" . strtoupper($this->escape($keyword)) . "%'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL query running using something like this: PreparedStatement pstmt = dbConn.prepareStatement(sqlQuery);
Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database
I have built a T-SQL query like this: DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND
I have a SQL query in my ASP.net web app that looks like this:
In T-SQL you could have a query like: SELECT * FROM Users WHERE User_Rights
i've a table like: i have to make sql query to get the average
In my SQL query in Access 2000, I have a field containing numbers like:
I have SQL Server 2008 with a table called ProductCategories designed like this: Id
I have a SQL Server 2005 output like this: Date | Result | Sum
I have been on this mysql query for 2 days running. This is the

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.