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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:16:41+00:00 2026-06-03T07:16:41+00:00

I made a website that contains products with the url: http://somesite.com/controller/function/brand_id/product_id . I would

  • 0

I made a website that contains products with the url: http://somesite.com/controller/function/brand_id/product_id. I would want to change those ID’s to more search friendly names. All those ID are in the DB with a name. Is it possible to get those names out of the DB and put them in the URL? This because i can’t use the routing tool. The products and brands are dynamically and could be deleted or (name) changed at any time. So can’t hardcode this into the routes.

Thanks for the effort

  • 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-03T07:16:43+00:00Added an answer on June 3, 2026 at 7:16 am

    You should be able to accomplish this by setting up some wildcard routes for brand_id and product_id. When you are performing the query for the product, you can just check to see if the URI segments are integers (IDs) or strings (names) and query the DB accordingly. I would store a URL-friendly version of the product name (replace spaces and special chars) and then query that, and also use that for generating links throughout the app.

    Update: Here is a code sample for the logic you would want in the method that you are routing everything through:

    public function search($brand, $product)
    {
        if (is_int($brand))
        {
            // Look up the brand using an ID
            $this->db->where('id', $brand);
        }
        else
        {
            // Look up the brand based on the URI segment
            $this->db->where('uri_friendly_name', $brand);
        }
    
        // Do the same with adding conditionals for $product and then run the query
    }
    

    and here is an example of the route you would need:

    $route['controller/function/(:any)/(:any)'] = "controller/search";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website that contains many different pages of products and each page
Ok. I recently made some updates to this website. http://annberingerart.com/index.php Upon making some minor
So I've finally made a website that looks great in every major modern browser.
I have a website that I made and I am planning to redo it.
Is there a website or documentation that details the changes made from each version?
I made a website, and I called it rar.com, which happens to be a
I would like to show a video on a website made of a dynamic
I have created a test website that contains a single ASP.net index.aspx file that
I have made a navbar at the top of my website which contains multiple
I made a website that needs to execute some kind of C++ program (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.