Jump to content


Photo

Search


  • Please log in to reply
4 replies to this topic

#1 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 08 October 2006 - 04:53 PM

Right, I'm making a search to query my table and display results

Ive hit a bit of a problem though

Basically, I have a table that my look like the following (in row display form)

1 Jamie Member Hello Yes
2 Jamie Member Hello Yes
3 Kev Member Hello Yes
4 Kev Member Hello Yes


Now, my query is going to query the table to find all fields that are Yes. As you can see in that table, each row has a Yes field

The way I want it displayed, is return the username once if a row has a Yes

So, the query would return

Jamie
Kev

Thats the problem I have, I can only get it to return:

Jamie
Jamie
Kev
Kev


So in other words, once it finds Yes it only echoes the username once regardless of how many rows its in

How?
I would love to change the world, but they won't give me the source code

SEO Agency

#2 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 08 October 2006 - 05:47 PM

select distinct * from table where yescolumn = 'Yes'

#3 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 08 October 2006 - 09:35 PM

Here is my query

$query = "SELECT distinct * FROM `songs` WHERE `$searchby` LIKE '%$searccriteria%'";

It isnt working, its still returning all occurances
I would love to change the world, but they won't give me the source code

SEO Agency

#4 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 09 October 2006 - 02:28 AM

Its working now. For some reason it wasnt allowing me to use the WILD CARD
I would love to change the world, but they won't give me the source code

SEO Agency

#5 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 09 October 2006 - 05:56 AM

Might have been a variable interpolation issue.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users