Skip to content
Advertisement

If pagename then run statment

I’m building a blog and have two tables articles and categories and I’m joining these tables, but what I want to do is display just the categories if I click a categories link. I’m passing the categories_id in the link but I can’t figure out how to display just the categories if the page link is like blog.php?=category_id. I’ll have the categories_id number in the URL I just can’t figure out how to display just that category, I know the SQL statement to just display the categories but what I can’t figure out is how to run that statement if the URL contains the the?=category_id and not run my original SQL statement that was displaying all the articles by date. I tried to do if and else conditions depending on the page name but wasn’t working.

Advertisement

Answer

As you’ve been told in the comments, you have to use only parameter, not the whole request.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement