Jump to content

search


spearchilduser

Recommended Posts

hi im currently doign a search on a database but i want it to only show the entries in the database and as some are duplicated they apear more than once

for exmaple if house was in the databse 4 times i only want it shown once

 

is this guna be a search but with _rows ? or im really lost any help please

Link to comment
https://forums.phpfreaks.com/topic/259553-search/
Share on other sites

You can use the "DISTINCT" keyword which will only return rows in the database that are unique - that means every column selected has to have the same values for it to be considered a duplicate (i.e. if the ID is different they won't be considered distinct). You should really fix the problem at the source though, and remove the duplication through a technique known as database normalisation.

Link to comment
https://forums.phpfreaks.com/topic/259553-search/#findComment-1330465
Share on other sites

i would love to format it but its a buit difficult and outta my league in regards to why the data is going in there basically the user can save a option in a table and if they select that option in future then instead of just selecting it it inserts it into the database as  new entry so it will be there twice which is why i want to only pull it in the dropbox once

 

if that makes scence

Link to comment
https://forums.phpfreaks.com/topic/259553-search/#findComment-1330470
Share on other sites

Not quite following what you're saying, but it sounds like you should be normalising the data. It's not difficult, and once you've read about the technique it just makes sense to do it that way. As for your situation though, I don't understand why you would only want to return 1 of the rows? Surely they would all be applicable?

Link to comment
https://forums.phpfreaks.com/topic/259553-search/#findComment-1330475
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.