I know how to do a fetch array to create a while loop as well as the mysql query in ASC order.

What I'm trying to sort out is how I might be able to make it create the ASC order but to ignore the initial words "The" or "A" in the results

example if the records have

-Running Around
-The End Game
-A Robotic Arm
-Mighty Mouse

I want the result to show

  1. The End Game
  2. Might Mouse
  3. A Robotic Arm
  4. Running Around

when it shows me the listed results in ASC order

Thanks for your time and help

order by
    if(
        substr(`ord_column`, 1, 2)='A ',
        substr(`ord_column`, 3),
        if(
            substr(`ord_column`, 1, 4)='The ',
            substr(`ord_column`, 5),
            `ord_column`
            )
        )

or mutch readable (result will be same)

order by
    case
        when substr(`ord_column`, 1, 2)='A ' then substr(`ord_column`, 3)
        when substr(`ord_column`, 1, 4)='The ' then substr(`ord_column`, 5)
        else `ord_column`
    end

Not sure how to mark something as solved but it is ... thankyou AndrisP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.