Hi i have a pages on my cms
and I made a category system now i dont now how to add the category to the pages
i want to have an option on the new add of page by the category that i made

someone now how to ?

Recommended Answers

Did you write this CMS ? Then you should have a category column in your pages table, and on the add screen create a dropdown with the available categories.

Jump to Post

In the pages table add a category_id column, that contains the id of the selected category.

Jump to Post

All 7 Replies

Did you write this CMS ? Then you should have a category column in your pages table, and on the add screen create a dropdown with the available categories.

yes i write the cms but how do i connect the pages table to the category tabel

In the pages table add a category_id column, that contains the id of the selected category.

ok but then how do i show the page under the category

Please explain what you want to show. A list of categories with the pages that are in it ?

That depends on how your tables look, but basically something like this:

SELECT * FROM categories c, pages p WHERE c.id = p.category_id ORDER BY c.id, p.id
Be a part of the DaniWeb community

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