Jump to content

Recommended Posts

hi there,

 

i have a database of news stories about my company. i want to put the stories into catagories so a user can click a button and get stories related to say, products.

 

some stories go in more than one catagory so for normalization i have three tables.

 

1. the text of the story

2. a list of possible catagories

3. a reference linking the story to the catagory

 

this works fine but i also want users to be able to search for two catagories at once ie. products and web design. if a story is in both these catagories it gets returned twice as the sql finds a reference linking it to one catagory then a reference linking it to the other.

 

I can sort it out so both aren\'t printed on the page but it messes up my number of items found and hence my pagination.

 

is there a better way of setting up my db or any sql that can sort this , or do i have to code around it?

Link to comment
https://forums.phpfreaks.com/topic/840-same-record-diff-catagories-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.