patelp7 Posted April 22, 2007 Share Posted April 22, 2007 i got a search function and for some reason every results are pulled out twice. Can sum1 PLEASE HELP!!! $query = "select B.Bulletin_ID ,B.Subject, B.Description from Bulletin B, Relative R WHERE B.Adminusername = R.Adminusername AND B.Description like '%$searchDesc%'"; above is the code in PHP. I done it in MySQL as well without the loops that i have in PHP and the results still pulled out twice. select B.Bulletin_ID ,B.Subject, B.Description from Bulletin B, Relative R WHERE 'shakeys' = 'shakeys' AND 'vw' like 'vw'; Does anyone know why? or have any ideas? Link to comment https://forums.phpfreaks.com/topic/48077-mysql-search-function-help/ Share on other sites More sharing options...
Barand Posted April 22, 2007 Share Posted April 22, 2007 If you don't specify a join condition between Bulletin and Relative then each record in Bulletin is joined to each record in Relative. Your first query does, the second doesn't. So which gives the problem? They're completely different. Also "WHERE 'shakeys' = 'shakeys' AND 'vw' like 'vw' " will pull all records as vw is always equal to vw Link to comment https://forums.phpfreaks.com/topic/48077-mysql-search-function-help/#findComment-234978 Share on other sites More sharing options...
patelp7 Posted April 22, 2007 Author Share Posted April 22, 2007 the PHP query gives the problem. Do you know how to not make it repeat? thank you. Link to comment https://forums.phpfreaks.com/topic/48077-mysql-search-function-help/#findComment-234980 Share on other sites More sharing options...
Barand Posted April 22, 2007 Share Posted April 22, 2007 SELECT DISTINCT B.Bulletin_ID ,B.Subject, B.Description ...... Link to comment https://forums.phpfreaks.com/topic/48077-mysql-search-function-help/#findComment-234983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.