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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:28:39+00:00 2026-05-23T20:28:39+00:00

I have a table that contains company names in this format: Name Name ,

  • 0

I have a table that contains company names in this format: Name Name, and I have a search box that performs a MySQL query to return data based on the search string.

Let’s say my table data looks like this:

Company
----------
Name Name
Name Name

And so on and so forth, and my query looks like this:

$sql = "SELECT * 
          FROM scoreboard 
         WHERE codcliente = '".$q."' 
            OR nombre LIKE '%".$q."%'";

Now, everything works fine when I try: nam, Nam, Name, Name N, NAM, NAME, and NAME N. My question is why doesn’t it work with: name or name n? Obviously it might have to do with the mixed case in the table data, but if so, why does nam work?

Here’s the SHOW CREATE TABLE scoreboard result:

CREATE TABLE `scoreboard` (
  `id` int(11) NOT NULL DEFAULT '0',
  `codcliente` text,
  `nombre` text,
  `ejecutivo` text,
  `banca_as400` text,
  `banca_real` text,
  `ingresos` varchar(20) DEFAULT NULL,
  `ciiu` text,
  `division` text,
  `actividad` text,
  `riesgo_industria` text,
  `riesgo_cliente` text,
  `fecha` date DEFAULT NULL,
  `analista` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
  • 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-05-23T20:28:39+00:00Added an answer on May 23, 2026 at 8:28 pm

    To avoid case problems, compare them all in uppercase so you won’t be disturbed by case.

    $sql = "SELECT * 
              FROM scoreboard 
             WHERE upper(codcliente) = '".strtoupper($q)."' 
                OR upper(nombre) LIKE '%".strtoupper($q)."%'";
    

    Seems hacky, but nevertheless reliable.

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

Sidebar

Related Questions

I have a database with a table that contains Name and CompanyName . They
I have a table, Orgs, that contains the following data: ID Name AddressID 0
I have a table that contains all the employees in a company (hr_employees). In
I have a table, that contains employees. Since the company I'm working for is
I have a table that contains multiple dropdown menus for a list of profile
I have a table that contains the following columns: ID int, DISTANCE float, EVENT
I have a table that contains all the data about users . Users can
I have a table that contains common entries in two columns. For Example: Column1
I have a table that contains the stock. It's legacy database and the stock
I have a table that contains a record of prioritys that links to another

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.