• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with getting the data from database with clean URL

#1
Hello,

I'm using codeigniter 3.1.10. Here I have few category names stored in the MySQL database and displaying on a webpage.

So the link I want is "domain/category/category_name"

Here "/category/" is defined in the route and I have converted "category_name" as "Slug" and called in the URL.

when I click the category name on the webpage the URL is "domain/category/category_name(slug)" which is perfect but the products which are related to that category is not showing on the webpage.

How should I pass category id to get the related products of that category from the database and show on webpage? what concept should I apply here ?
Reply

#2
First you need to get the id your not stating where you are getting the id from, there are several ways of
passing id's.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
actually we have 2 different kind 1 is product and another is service. So I have defined a status as 1 for product and 2 for service. So how to pass those parameters so that when user visits product related categories products will show and service categories will show services

With slug as foreign key I can do it but I want to pass unique id not the slugs.

Let me know how can I pass id
Reply

#4
As I mentioned above there are lots of ways on how to do.

You can save the id to the session and then get them from the session.

You can also use a hidden input and set them then check the input post of it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.