jaymc Posted October 8, 2006 Share Posted October 8, 2006 Right, I'm making a search to query my table and display resultsIve hit a bit of a problem thoughBasically, I have a table that my look like the following (in row display form)[b]1 Jamie Member Hello Yes2 Jamie Member Hello Yes3 Kev Member Hello Yes4 Kev Member Hello Yes[/b]Now, my query is going to query the table to find all fields that are [b]Yes[/b]. As you can see in that table, each row has a [b]Yes[/b] fieldThe way I want it displayed, is return the username once if a row has a [b]Yes[/b]So, the query would returnJamieKevThats the problem I have, I can only get it to return:[b]JamieJamieKevKev[/b]So in other words, once it finds [b]Yes[/b] it only echoes the username once regardless of how many rows its inHow? Quote Link to comment https://forums.phpfreaks.com/topic/23363-search/ Share on other sites More sharing options...
alpine Posted October 8, 2006 Share Posted October 8, 2006 select distinct * from table where yescolumn = 'Yes' Quote Link to comment https://forums.phpfreaks.com/topic/23363-search/#findComment-105938 Share on other sites More sharing options...
jaymc Posted October 8, 2006 Author Share Posted October 8, 2006 Here is my query[code]$query = "SELECT distinct * FROM `songs` WHERE `$searchby` LIKE '%$searccriteria%'";[/code]It isnt working, its still returning all occurances Quote Link to comment https://forums.phpfreaks.com/topic/23363-search/#findComment-105991 Share on other sites More sharing options...
jaymc Posted October 9, 2006 Author Share Posted October 9, 2006 Its working now. For some reason it wasnt allowing me to use the WILD CARD Quote Link to comment https://forums.phpfreaks.com/topic/23363-search/#findComment-106056 Share on other sites More sharing options...
fenway Posted October 9, 2006 Share Posted October 9, 2006 Might have been a variable interpolation issue. Quote Link to comment https://forums.phpfreaks.com/topic/23363-search/#findComment-106107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.